// // IfishAlibcWebViewController.m // Ifish // // Created by imac on 17/4/12. // Copyright © 2017年 lianlian. All rights reserved. // #import "IfishAlibcWebViewController.h" #import #import #import "NJKWebViewProgressView.h" #import "NJKWebViewProgress.h" #import "IfishMianTabViewController.h" @interface IfishAlibcWebViewController () { NJKWebViewProgressView *_progressView; NJKWebViewProgress *_progressProxy; } @end @implementation IfishAlibcWebViewController - (instancetype)init { self = [super init]; if (self) { _webView = [[UIWebView alloc]initWithFrame:self.view.bounds]; _webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _webView.scrollView.scrollEnabled = YES; _webView.delegate = self; [self.view addSubview:_webView]; _progressProxy = [[NJKWebViewProgress alloc] init]; // instance variable _webView.delegate = _progressProxy; _progressProxy.webViewProxyDelegate = self; _progressProxy.progressDelegate = self; CGFloat progressBarHeight = 2.f; CGRect navigationBarBounds = self.navigationController.navigationBar.bounds; CGRect barFrame = CGRectMake(0, navigationBarBounds.size.height - progressBarHeight, navigationBarBounds.size.width, progressBarHeight); _progressView = [[NJKWebViewProgressView alloc] initWithFrame:barFrame]; _progressView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self addTitleViewWithTitle:@"商品详情"]; [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault]; } #pragma mark - UIWebViewDelegate - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return YES;// [AppMonitor turnOnAppMonitorRealtimeDebug:@{@"debug_api_url":@"http://muvp.alibaba-inc.com/online/UploadRecords.do",@"debug_key":@"baichuan_sdk_utDetection"}]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - NJKWebViewProgressDelegate -(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress { [_progressView setProgress:progress animated:YES]; } -(void)goBackAction{ [self setAppTabRoot]; } //设置根视图 -(void)setAppTabRoot{ IfishMianTabViewController *mianVC=[[IfishMianTabViewController alloc] init]; [UIApplication sharedApplication].delegate.window.rootViewController=mianVC; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end