Я делаю приложение, которое имеет 2 контроллера навигации.У одного есть tableView, и при нажатии в ячейках я хочу загрузить другой viewController, но у меня всегда есть эта ошибка:
fifthvieController may no respond to -navigationController2
Вот код:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *letraSeleccionada = [lista objectAtIndex:indexPath.row];
FourthViewController *fourth = [[FourthViewController alloc]initWithNibName:@"FourthViewController" bundle:nil];
fourth.letraSeleccionada = letraSeleccionada;
[[self navigationController2] pushViewController:fourth animated:YES]; //here
[fourth release];
fourth = nil;
}
Я изменил код, и теперь он работает, но я не понимаю, почему раньше он не работал.Вот новый код:
PruebaPushAppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.navigationController2 pushViewController:fourth animated:YES];
//[[self navigationController2] pushViewController:fourth animated:YES];