bug 漂流记一。

最近一直在用UIWebView!!!!

严重的ERROR:在一次通过webView进行load的时候,webView错误的request了五次,于是乎一开始以为是webView的错误。检查了五分钟的WebView,感觉没有错误,就认定是这个网页的错误了。

 

服务端花了一个小时的辛苦检查,嗯,证明服务端没有错误。

 

这次从头看了一下所有的代码:

- (void)loadView
{   
//    mainWebView = [[UIWebView alloc] init];
    mainWebView = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    mainWebView.delegate = self;
    mainWebView.scalesPageToFit = YES;
    mainWebView.opaque = NO;
    mainWebView.scrollView.scrollEnabled = NO;
    [mainWebView addSubview:self.closeButton];
    
    self.tapGes = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                          action:@selector(tapAction:)];
    self.tapGes.delegate = self;
    [mainWebView addGestureRecognizer:self.tapGes];
//    self.view = mainWebView;
    [self.navigationController.view addSubview:mainWebView];
}

一开始的代码是这样子的。

 

不知道你们看出来错误没有……嗯,在loadview里面self.view此时还是nil.

主要是因为少调用了父类的loadview!!!!!

 

至于为什么5次,正在研究中

posted on 2014-11-14 19:09  best_cook  阅读(125)  评论(0)    收藏  举报

导航