在ios 5中使用故事板的UITableViewController

时间:2011-11-10 09:48:21

标签: ios ios4 ios5 ios-4.2

我已经开始使用故事板,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]; 
    }

}

但是知道,我该怎么做...请帮助我

谢谢&问候 兰吉特

1 个答案:

答案 0 :(得分:0)