我如何卸载UIWebView

时间:2012-03-06 22:46:25

标签: objective-c uiwebview

还有比这更好的方法吗? killWebView方法中的loadRequest是一个黑客,可以摆脱像youtube这样的webPages。我不想这样做,但我找不到任何关于如何卸载WebView的文档......

- (IBAction)killWebView:(id)sender 
{
[self.webView stopLoading];
[self.webModal setHidden:YES];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
}

- (IBAction)viewVideoLink:(id)sender 
{
 self.webModal.backgroundColor = [self randomColor:.4];
[self.webModal setHidden:NO];    
NSString *strWebsiteUlr = [NSString stringWithFormat:[NSString stringWithFormat:@"%@",   [self.model.currentTrackDictionary objectForKey:@"video_url"]]];
NSURL *url = [NSURL URLWithString:strWebsiteUlr];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:requestObj];
}

1 个答案:

答案 0 :(得分:1)

您正在发布self.webView,然后两行,您正在向self.webView发送消息。这将导致崩溃。