storyboard: 创建一个ViewController, 添加配套nibs文件,命名:ViewController
从Source Control 拖拽一个Web View, 调整大小。
将Web View 关联到ViewController.h头文件。
文件编辑:
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController :UIViewController
@property (weak, nonatomic) IBOutletUIWebView *webView;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSURLRequest * request = [NSURLRequestrequestWithURL:[NSURLURLWithString:@"http://www.163.com"]];
[self.webViewloadRequest:request];
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end