pushviewcontroller不工作,因为self.navigationController为空
我有一个很大的问题:方法didSelectRowAtIndexPath
我总是得到null self.navigationController。我有一个UIViewController,它包含一个UIsegmentedControl和一个子视图。在这个子视图中,我为每个选定的段添加控制器。对于每个段有一个tableview。这里是问题:当我从这个tableview中选择一行时,我无法推送下一个控制器,因为self.navigationController为空。pushviewcontroller不工作,因为self.navigationController为空
请帮me..Here是我的代码:http://pastebin.com/qq0vf7mq
无代码:
navigationTelephone=[[UINavigationController alloc] init];
[self.view addSubview:self.navigationTelephone.view];
[self.navigationTelephone setNavigationBarHidden:YES];
[self.view addSubview:tableViewTelephone];
我认为你必须初始化的UINavigationController像下面
[[UINavigationController alloc] initWithRootViewController:ViewControllerOBj]
我写navigationTelephone = [[UINavigationController的页头] initWithRootViewController:self.myAudiCoordonneesViewController ]。但我得到应用程序试图推动一个无视图控制器的目标
更新时间:
您初始化一个实例变量navigationTelephone
并显示它,但您使用self.navigationController
推! 使用[navigationTelephone push...]
代替
我有它,但它不工作...不推动下一个viewcontroller – Gabrielle
试试这个:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
myAudiPhoneInputViewController *myViewController = [[myAudiPhoneViewController alloc] initWithNibName:@"NIB NAME HERE" bundile:nil];
self.myaudiPhoneInputViewController = myViewController;
[myViewController release];
[tableViewTelephone deselectRowAtIndexPath:indexPath animated:NO];
if(indexPath.row==0){
NSLog(@"Tel.personnel... %@",self.navigationTelephone);
[self.navigationController pushViewController:self.myaudiPhoneInputViewController animated:YES];
}
}
您还没有实例化myaudiPhoneViewController这就是为什么它不是推的观点。
通过改变只要检查,
self.navigationTelephone=[[UINavigationController alloc] init];
纳文珊
你的应用程序是基于导航或任何其他基于应用 – Narayana
是基于引导 – Gabrielle