ifish/Ifish/controllers/FishTinkController/centerPushcontrollers/BrandDetailViewController.m

57 lines
1.5 KiB
Objective-C

//
// BrandDetailViewController.m
// Ifish
//
// Created by imac on 15/10/28.
// Copyright © 2015年 imac. All rights reserved.
//
// 品牌详情
#import "BrandDetailViewController.h"
@interface BrandDetailViewController ()<UIWebViewDelegate>
{
UIActivityIndicatorView *activityIndicatorView;
}
@property(nonatomic,strong)UIWebView*myWebView;
@end
@implementation BrandDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self creatWebView];
[self addTitleViewWithTitle:@"品牌详情"];
}
-(void)creatWebView{
self.myWebView=[[UIWebView alloc]initWithFrame:self.view.bounds];
NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:self.model.brandIntroduce]];
[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: nil];
[alterView show];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end