#import "HotelViewController.h"
@interface HotelViewController ()<UIWebViewDelegate>
@property (nonatomic, strong) UIWebView *webView;
@end
@implementation HotelViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
//添加代理
self.webView.delegate = self;
[self.view addSubview:self.webView];
NSURLRequest *url = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://touch.qunar.com/h5/hotel/hotellist?city=%E5%8C%97%E4%BA%AC&cityUrl=beijing_city&checkInDate=2015-10-28&checkOutDate=2015-10-29&location=&keywords=%E6%B5%B7%E6%B7%80%E5%8C%BA&pr=&level=&back=&sort=3"]];
[self.webView loadRequest:url];
}
- (UIWebView *)webView
{
if (!_webView) {
_webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
_webView.backgroundColor = [UIColor redColor];
_webView.dataDetectorTypes = UIDataDetectorTypeAll;
[self.view addSubview:_webView];
}
return _webView;
}