// // FaXianDetailViewController.m // jitao // // Created by 罗云飞 on 2018/9/14. // Copyright © 2018年 罗云飞. All rights reserved. // #import "FaXianDetailViewController.h" #import @interface FaXianDetailViewController () @property (nonatomic, strong) UIWebView *webView; @end @implementation FaXianDetailViewController - (void)viewDidLoad { [super viewDidLoad]; [self setNavTitle:[NSString stringWithFormat:@"%@详情",self.type]]; [self loadUI]; // Do any additional setup after loading the view. } - (void)loadUI{ NSMutableString *string = [NSMutableString stringWithString:self.neirong]; NSString *haha = [NSString stringWithFormat:@"

%@

%@

",self.title,self.time]; [string insertString:haha atIndex:0]; NSString *strUrl = [string stringByReplacingOccurrencesOfString:@"//statics" withString:@"http://statics"];//替换字符 NSString *htmlString = [NSString stringWithFormat:@" \n" " \n" " \n" " \n" "" "%@" "" "", strUrl]; NSLog(@"===== %@",htmlString); self.webView = [[UIWebView alloc] init]; // [self.webView setScalesPageToFit:YES]; self.webView.frame = CGRectMake(0, NavHeader, SCREEN_WIDTH, SCREEN_HEIGHT-NavHeader); self.webView.delegate = self; [self.webView loadHTMLString:htmlString baseURL:nil]; //添加到view中 [self.view addSubview:self.webView]; } - (void)webViewDidFinishLoad:(UIWebView *)webView //网页加载完成的时候调用 { //HTML5的高度 // CGFloat htmlheight = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue]; // self.webView.frame = CGRectMake(0, ViewStartY, SCREEN_WIDTH, htmlheight); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #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