mar*_*rcy 2 iphone cocoa-touch objective-c
我想在选择表格单元格时显示Web视图
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[uiWebView loadRequest:[NSURL URLWithString:@"http://www.google.com"]];
[self.navigationController pushNavigationItem:uiWebView animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
日志
-[UINavigationController pushNavigationItem:animated:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
小智 14
上面的代码不起作用,也有一些泄漏. -
这是修改后的版本.
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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9924 次 |
| 最近记录: |