我现在正在用tableview创建一个应用程序现在我想要发生的是当我点击第一行时它将显示view1,当我点击第二行时它将显示view2。我怎样才能做到这一点?tableview根据点击的行打开不同的视图
我试图使用if else语句ID我didSelectRowAtIndexPath
,但它并没有在这里工作是我的一段代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int EntryIndex = [indexPath indexAtPosition:[indexPath length]-1];
{
AboutViewController *aboutView = [[AboutViewController alloc]init];
aboutView.getId4 = [[contentArray objectAtIndex:EntryIndex]objectForKey:@"title"];
aboutView.aboutofficeId = getId3;
[self.navigationController pushViewController:aboutView animated:YES];
}
else
{
DepartmentsViewController *deptView = [[DepartmentsViewController alloc]init];
deptView.getId5 = [[contentArray objectAtIndex:EntryIndex]objectForKey:@"title"];
deptView.deptoffice = getId3;
[self.navigationController pushViewController:deptView animated:YES];
}
}
üWnt信号添加的UIView或UIViewController中>> – iPatel 2013-02-11 10:21:00
我想添加一个新的UIViewController :) – 2013-02-12 01:55:32