繁体   English   中英

无法从桌子打开野生动物园

[英]Cannot open safari from table

我正在尝试学习如何使用表格,我有一个多视图应用程序。 我可以让它用数据加载表,当我单击该表项时,我希望它加载另一个Viewcontroller,这是行不通的(没有错误,只是什么都没有改变),所以我决定用一个safari页面进行测试而且这也无能为力。 有任何想法吗?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.

  //  SecondViewController *loadview = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
    // ...
    // Pass the selected object to the new view controller.
 //   [self.navigationController pushViewController:loadview animated:YES];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];    
   // [loadview release];

}

您必须在URL字符串中写http://才能使用openURL:方法打开Safari。
尝试这个:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com/"]];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM