我現在正在用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