2011-02-28 55 views
0

你好,我试图推入不同的nibfiles到视图中 当你点击它对应的uitablecell。 我不知道从哪里开始。Uitablecell推入不同的笔尖

+2

开始阅读一些文件?相关的类和协议:UITableView,UITableViewDelegate,UITableViewDataSource。即使内置的基于导航的应用程序模板也具有您想要的功能 - 您可以从中获得基本的想法。 – Vladimir 2011-02-28 06:42:49

+0

这个问题类似于已经问过http://stackoverflow.com/questions/5102122/how-can-i-move-to-another-view-controller-when-the-user-clicks-on-a-row/ 5102284#5102284首先尝试搜索然后问这里 – Sudhanshu 2011-02-28 07:19:06

回答

2

阅读的UITableView类和基于导航应用,看看这个代码

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

    //and code like this 

    if(indexPath.row==0) 
    { 
    FirstController *objFirstController=[[[FirstController alloc] initWithNibName:@"FirstView" bundle:nil] autorelease]; 
[self.navigationController pushViewController:objFirstController animated:YES]; 
    } 
else 
{ 
    SecondController *objSecondController=[[[SecondController alloc] initWithNibName:@"SecondView" bundle:nil] autorelease]; 
[self.navigationController pushViewController:objSecondController animated:YES]; 
} 
}