ifish/Ifish/controllers/leftcontrollers/BookViewController.m

87 lines
2.7 KiB
Objective-C

//
// BookViewController.m
// Ifish
//
// Created by imac on 15/11/23.
// Copyright © 2015年 imac. All rights reserved.
//
#import "BookViewController.h"
#import "UIViewController+MaryPopin.h"
@interface BookViewController ()<UIWebViewDelegate>
@property(nonatomic,strong)UIWebView*myWebView;
@property(nonatomic,strong)UIActivityIndicatorView*indicator;
@end
@implementation BookViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem*rightItem=[[UIBarButtonItem alloc]initWithTitle:@"授权" style: UIBarButtonItemStyleDone target:self action:@selector(ItemClick)];
rightItem.tintColor=[UIColor whiteColor];
self.navigationItem.rightBarButtonItem=rightItem;
[self addTitleViewWithTitle:@"观赏鱼图鉴"];
[self creatwebView];
[self initIndicatorView];
}
-(void)ItemClick{
UIViewController*popin=[[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"PlayNDropViewController"];
popin.view.bounds=CGRectMake(0, 0, 300, 135);
[popin setPopinTransitionStyle:BKTPopinTransitionStyleSnap];
BKTBlurParameters *blurParameters = [[BKTBlurParameters alloc] init];
blurParameters.tintColor = [UIColor colorWithWhite:0 alpha:0.5];
blurParameters.radius = 0.3;
[popin setBlurParameters:blurParameters];
[popin setPopinTransitionDirection:BKTPopinTransitionDirectionTop];
[self presentPopinController:popin animated:YES completion:^{
NSLog(@"Popin presented !");
}];
}
-(void)creatwebView{
self.myWebView.opaque=NO;
self.myWebView.backgroundColor=[UIColor clearColor];
self.myWebView=[[UIWebView alloc]initWithFrame:self.view.bounds];
//NSString*url=[NSString stringWithFormat:kTuJianUrl];
// NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:url]];
//[self.myWebView loadRequest:requst];
[self.view addSubview:self.myWebView];
self.myWebView.delegate=self;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(void)webViewDidStartLoad:(UIWebView *)webView{
[_indicator startAnimating];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
[_indicator stopAnimating];
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
[_indicator stopAnimating];
}
-(void)initIndicatorView{
_indicator=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_indicator.frame=CGRectMake(0.f,0.f,100.f, 100.f);
_indicator.backgroundColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
_indicator.center=self.view.center;
_indicator.layer.masksToBounds=YES;
_indicator.layer.cornerRadius=5;
[self.view addSubview:_indicator];
}
@end