热更新demo

linkController.m 1.5KB

    // // linkController.m // ThePaperBase // // Created by 李元元 on 16/5/16. // Copyright © 2016年 scar1900. All rights reserved. // #import "linkController.h" @interface linkController ()<UIWebViewDelegate>{ NSString *url; } @property(nonatomic ,strong)UIWebView *webView; @end @implementation linkController - (void)viewDidLoad { [super viewDidLoad]; [self.view addSubview:self.webView]; self.webView.frame = CGRectMake(0, 64, rect_screen.size.width, rect_screen.size.height); NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; [self.webView loadRequest:request]; // Do any additional setup after loading the view. } -(void)setWebUrl:(NSString *)webUrl{ url = webUrl; } -(UIWebView *)webView{ if (!_webView) { _webView = [[UIWebView alloc] init]; _webView.backgroundColor = [UIColor clearColor]; _webView.scalesPageToFit = YES; _webView.delegate = self; } return _webView; } - (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