我想在选择表格单元格时显示网页 View
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[uiWebView loadRequest:[NSURL URLWithString:@"http://www.google.com"]];
[self.navigationController pushNavigationItem:uiWebView animated:YES];
}
日志
-[UINavigationController pushNavigationItem:animated:]: unrecognized selector sent to instance
最佳答案
上面的代码不起作用,也有一些泄漏。 -
这是修改后的版本。
UIViewController *webViewController = [[[UIViewController alloc]
init] autorelease];
UIWebView *uiWebView = [[[UIWebView alloc]
initWithFrame: CGRectMake(0,0,320,480)] autorelease];
[uiWebView loadRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
[webViewController.view addSubview: uiWebView];
[self.navigationController
pushViewController:webViewController animated:YES];
关于iphone - 如何在NavigationController中推送WebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1736625/