我在一個視圖中有一個UITableViewCell和UItableView。點擊UITableView的特定行,它導航到另一個視圖控制器。但我無法導航到其他視圖控制器上單擊UITableViewCell 。我怎樣才能做到這一點??UITableViewCell和UITableView(沒有選擇一行)導航到其他視圖控制器
有關的UITableView我使用這個代碼:
- -(void)pushView1:(id)sender{ if(edController == nil) edController = [[EditableDetailCell alloc] initWithNibName:@"EditableDetailCell" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:edController animated:YES]; } - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; UITableViewCell *tbcel; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; tbcel.accessoryType = UITableViewCellAccessoryDisclosureIndicator; tbcel.layer.cornerRadius = 15; tbcel.text = aBook.Name; switch(indexPath.section) { case 0: cell.text = aBook.Address; break; case 1: cell.text = aBook.Phone; break; case 2: cell.text = aBook.Purchase; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(edController == nil) edController = [[EditableDetailCell alloc] initWithNibName:@"EditableDetailCell" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:edController animated:YES]; }![enter image description here][1]
我應該做的UITableViewCell?
UITableViewCell是表視圖的一部分嗎?那麼你爲什麼要分開採取行動 – visakh7 2011-04-06 10:25:15
它的UiTableViewCell不包括在Tableview中,它被單獨插入在View Through接口構建器庫中。 – Ketan 2011-04-06 10:31:19
無論是來自IB還是其他任何東西都無所謂。 UITableViewCell不是爲此目的。請參閱下面的答案。 – Xiao 2011-04-06 10:33:03