// // TRDetailVC.m // jiaPei // // Created by apple on 15/12/24. // Copyright © 2015年 JCZ. All rights reserved. // #import "TRDetailVC.h" #import @interface TRDetailVC () @end @implementation TRDetailVC - (void)viewDidLoad { [super viewDidLoad]; [self myInit]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(void)myInit { [self configNavigationBar]; [self.view setBackgroundColor:[UIColor whiteColor]]; if (_file.length >9 ) { [self setTitle:[[_file substringToIndex:9] stringByAppendingString:@"..."]]; }else{ [self setTitle:_file]; } WKWebView* webView=[[WKWebView alloc]initWithFrame:kFrame]; webView.height = kSize.height-kNavOffSet; webView.navigationDelegate = self; [self.view addSubview:webView]; NSString *htmlPath; NSURL *url; htmlPath = [[NSBundle mainBundle] pathForResource:_file ofType:@"html"]; if (htmlPath && ![htmlPath isEqualToString:@""]) { url = [NSURL fileURLWithPath:htmlPath isDirectory:NO]; [MBProgressHUD showLoadToView:self.view]; [webView loadRequest:[NSURLRequest requestWithURL:url]]; }else{ ShowMsg(@"未找到该页面"); } } #pragma mark - // 页面加载失败时调用 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error{ [MBProgressHUD hideHUDForView:self.view]; } // 页面加载完毕时调用 - (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{ [MBProgressHUD hideHUDForView:self.view]; } @end