在新的Storyboard中从Prototype Cell打开Safari

时间:2012-09-05 19:24:17

标签: iphone ios5

我在storyboard中定义的ViewController中有一个tableview。 tableview有原型单元格。我希望当用户触摸单元格时,网址应该在iphone的外部游戏中打开。怎么实现呢? 从哪里我必须调用以下行:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:siteURL]]; 

1 个答案:

答案 0 :(得分:0)

在实例设置为表视图的委托的类中:

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)ip
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:siteURL]];
}