#import "RootViewController.h"
@interface RootViewController ()
@property (nonatomic, strong) UIWebView *webview;
@end
@implementation RootViewController
- (void)viewDidLoad {
[super viewDidLoad];
//创建webView
self.webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.view addSubview:self.webview];
//根据URL,在webView上显示内容
[self loadWebViewPageWithURLString:@"
http://daily.zhihu.com/story/4166185"];
}
//具体实现方法
- (void)loadWebViewPageWithURLString:(NSString *)urlString
{
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:request];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end