我有一个需要打开 Web 视图的 UITableViewController。
在我的功能中,我有:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
LinkViewController *linkViewController = [[LinkViewController alloc] initWithNibName:@"LinkViewController_iPhone" bundle:nil];
[linkViewController.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
[self.navigationController pushViewController:linkViewController animated:YES];
}
我已连接所有插座,但没有收到任何警告,但我没有看到页面拉起。
但是,如果我进入实际的 LinkViewController 文件并执行以下操作:
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlAddress = @"http://www.google.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[self.webView loadRequest:requestObj];
}
一切似乎都很好。我不明白为什么 ?