gpt4 book ai didi

iphone - 如何在NavigationController中推送WebView

转载 作者:行者123 更新时间:2023-12-03 20:18:13 25 4
gpt4 key购买 nike

我想在选择表格单元格时显示网页 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com