// // DownLoadViewController.m // Ifish // // Created by imac on 15/12/5. // Copyright © 2015年 imac. All rights reserved. // #import "DownLoadViewController.h" #import "AppDelegate.h" #import "AFNetworking.h" #import "LeftViewController.h" #import "CenterViewController.h" #import "ICSDrawerController.h" #import "RightViewController.h" #import "MyMD5.h" //#import #import "LogInViewController.h" #define RONYUN_APPKEY @"cpj2xarljddbn"// 融云appkey #import "ChatroomModel.h" #import "AppDelegate.h" @interface DownLoadViewController () @property(nonatomic,strong)UIWebView*myWebView; @property(nonatomic,strong)UIActivityIndicatorView*indicator; @property(nonatomic,strong)ICSDrawerController*ics; @property(nonatomic,strong)NSMutableArray*deviceArry; @property(nonatomic,strong)NSMutableArray*chatroomArray; @end extern BOOL formLogIn; @implementation DownLoadViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor=[UIColor whiteColor]; [self addTitleViewWithTitle:@"下载页"]; [self creatwebView]; [self initIndicatorView]; self.bakbutton = [UIButton buttonWithType:UIButtonTypeCustom]; self.bakbutton.frame = CGRectMake(0, 0, 60,36); [self.bakbutton setBackgroundImage:[UIImage imageNamed:@"ic_goback"] forState:UIControlStateNormal]; [self.bakbutton addTarget: self action: @selector(goBackActionDowlod) forControlEvents: UIControlEventTouchUpInside]; if (_ismust==YES) { self.bakbutton.hidden=YES; }else{ self.bakbutton.hidden=NO; } self.back=[[UIBarButtonItem alloc]initWithCustomView:self.bakbutton]; self.navigationItem.leftBarButtonItem=self.back; _deviceArry=[[NSMutableArray alloc]init]; _chatroomArray=[[NSMutableArray alloc]init]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } -(void)creatwebView{ self.myWebView.opaque=NO; self.myWebView.backgroundColor=[UIColor clearColor]; self.myWebView=[[UIWebView alloc]initWithFrame:self.view.bounds]; NSString*url=self.downAddress; NSURLRequest*requst=[NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [self.myWebView loadRequest:requst]; [self.view addSubview:self.myWebView]; self.myWebView.delegate=self; } -(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]; CGRectMake(0.f,0.f,40.f, 40.f); _indicator.backgroundColor=[UIColor lightGrayColor]; _indicator.center=self.view.center; [self.view addSubview:_indicator]; } -(void)goBackActionDowlod{ if (self.fromsetView==YES) { [self.navigationController popViewControllerAnimated:YES]; }else{ [self dismissViewControllerAnimated:YES completion:^{ UIApplication*application=[UIApplication sharedApplication]; [self loginAnimated:application]; }]; } } -(void)loginAnimated:(UIApplication*)appliaction{ formLogIn=NO; [IFISHHTTPTOOL ifishLogindismissvc:nil]; } @end