Tengo UITableViewCell y UItableView en una sola vista. Al hacer clic en una fila concreta de UITableView, navega a otro ViewController. Pero no puedo navegar a otro ViewController al hacer clic en UITableViewCell .¿¿Cómo puedo hacer esto??UITableViewCell y UITableView (seleccionó una fila) navegación a otro Viewcontroller
Para UITableView estoy utilizando este código:
- -(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]
Qué debería hacer yo por UITableViewCell ??
UITableViewCell son parte de la vista de tabla, ¿no? Entonces, ¿por qué quieres tener una acción para él por separado? – visakh7
Es una UiTableViewCell no incluida en Tableview, se inserta en la biblioteca del constructor de interfaz View Through por separado. – Ketan
No importa si es de IB o algo. UITableViewCell no es para este propósito. Ver mi respuesta a continuación. – Xiao