我已经开始使用故事板,iOS 5中的一个新功能,所以我开始使用选项卡式应用程序,然后我添加了一个表视图控制器并用一些虚拟数据填充单元格,现在,该表有4个单元格,现在单击每个单元格,我想打开一个newViewController,这对于每个单元格都是不同的,
所以以前,我曾经这样编码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if(indexPath.row == 0)
{
FirstViewController *settingsView =[[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
[self.navigationController pushViewController:settingsView animated:YES];
}
if(indexPath.row == 1)
{
SecondViewController *settingsView =[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:settingsView animated:YES];
}
if(indexPath.row == 2)
{
ThirdViewController *settingsView =[[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
[self.navigationController pushViewController:settingsView animated:YES];
}
}
但是知道,我该怎么做...请帮助我
谢谢&问候 兰吉特
答案 0 :(得分:0)
也许本教程可以帮到你? http://kurrytran.blogspot.com/2011/10/ios-5-storyboard-uitableview-tutorial.html
我看到这一点(performSegueWithIdentifier:sender :)应该是从故事板中执行新viewcontroller的方法