81 lines
2.4 KiB
Objective-C
81 lines
2.4 KiB
Objective-C
//
|
|
// SongBaoViewController.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 15/10/13.
|
|
// Copyright © 2015年 imac. All rights reserved.
|
|
//
|
|
|
|
#import "SongBaoViewController.h"
|
|
#import "MoreBrandController.h"
|
|
|
|
@interface SongBaoViewController ()<UIWebViewDelegate>
|
|
{
|
|
|
|
UIActivityIndicatorView *activityIndicatorView;
|
|
}
|
|
@property(nonatomic,strong)UIWebView*myWebView;
|
|
|
|
|
|
@end
|
|
|
|
@implementation SongBaoViewController
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
[super viewWillAppear:animated];
|
|
self.navigationController.navigationBar.translucent = YES;
|
|
}
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
[super viewWillDisappear:animated];
|
|
self.navigationController.navigationBar.translucent = NO;
|
|
}
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self creatWebView];
|
|
|
|
[self addTitleViewWithTitle:@"品牌"];
|
|
|
|
// UIBarButtonItem *rt=[[UIBarButtonItem alloc]initWithTitle:@"更多品牌" style:UIBarButtonItemStyleDone target:self action:@selector(moreStore)];
|
|
// self.navigationItem.rightBarButtonItem=rt;//暂时隐藏
|
|
self.navigationItem.rightBarButtonItem.tintColor =[UIColor whiteColor];;
|
|
|
|
}
|
|
-(void)moreStore{
|
|
MoreBrandController*morevc=[[MoreBrandController alloc]init];
|
|
[self.navigationController pushViewController:morevc animated:YES];
|
|
|
|
}
|
|
-(void)creatWebView{
|
|
|
|
self.myWebView=[[UIWebView alloc]initWithFrame:self.view.bounds];
|
|
NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:self.brandIntroduce]];
|
|
// NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.61.128:7080/ifish/view/index.html"]];
|
|
[self.myWebView loadRequest:requst];
|
|
[self.view addSubview:self.myWebView];
|
|
|
|
activityIndicatorView=[[UIActivityIndicatorView alloc]init];
|
|
activityIndicatorView.frame=CGRectMake(kScreenSize.width/2, kScreenSize.height/2,50, 50)
|
|
;
|
|
[self.view addSubview:activityIndicatorView];
|
|
}
|
|
|
|
-(void)webViewDidStartLoad:(UIWebView *)webView{
|
|
[activityIndicatorView startAnimating];
|
|
}
|
|
-(void)webViewDidFinishLoad:(UIWebView *)webView{
|
|
[activityIndicatorView stopAnimating];
|
|
}
|
|
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
|
|
UIAlertView *alterView=[[UIAlertView alloc]initWithTitle:@"警告" message:@"打不开" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"OK", nil];
|
|
|
|
[alterView show];
|
|
|
|
}
|
|
- (void)didReceiveMemoryWarning {
|
|
[super didReceiveMemoryWarning];
|
|
|
|
}
|
|
@end
|