我已经开始使用 Storyboard,这是 iOS 5 中的一个新功能,所以我从一个选项卡式应用程序开始,然后我添加了一个表格 View Controller 并用一些虚拟数据填充单元格,现在,表格有 4 个单元格,现在点击每个单元格,我想打开一个新的ViewController,每个单元格都不同,
所以以前,我曾经这样编码
- (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];
}
}
但是知道,我该怎么做..请帮帮我
感谢和问候
兰 git
最佳答案
也许本教程会对您有所帮助?
http://kurrytran.blogspot.com/2011/10/ios-5-storyboard-uitableview-tutorial.html
正如我所看到的 (performSegueWithIdentifier:sender:) 应该是从 Storyboard 执行新 View Controller 的方法
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/performSegueWithIdentifier:sender :
关于ios - ios 5 中带有 Storyboard 的 Table ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8077613/