2012-03-15 62 views

回答

2

您将要实施的tableview委托方法,tableView:didSelectRowAtIndexPath:,这将使你要问这是选中的单元格的tableview,然后采取适当的行动。一个例子是:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 
    if ([cell.textLabel.text isEqualToString:@"google"]) { 
     // open google 
    } else if ([cell.textLabel.text isEqualToString:@"yahoo"]) { 
     // open yahoo 
    } 
} 

编辑来回答所提在评论中

您没有说明这个问题,但是从阅读你的问题,我猜你正在使用单独的榫文件和当用户选择一个静态单元格时,要在控制Web视图的屏幕上推动另一个视图控制器。步骤要做到这一点是:

  1. 创建新的VC
  2. 给公共财产要在代码看起来加载
  3. 推VC在屏幕上

网址类似于:

WebViewController webVC = [[WebViewController alloc] initWithNibName:@"your nib name" bundle:[NSBundle mainBundle]]; 
webVC.url = // some NSURL object, or maybe just a string that has the URL - that's up to you 
[self.navigationController pushViewController:webVC animated:YES] 
+0

但是,如何将它连接到下一个笔尖UIwebView?我需要在下一个笔尖中添加哪些代码?谢谢 – Clarence 2012-03-15 08:14:57

+0

看到我编辑的答案。 – 2012-03-15 19:36:24

相关问题