Iphone pushviewcontroller不工作,因为self.navigationController为空
我有一个大问题:在didselectrowatinexpath方法上,self.navigationController的值总是为null。我有一个UIViewController,它包含一个UIsegmentedControl和一个子视图。在此子视图上,我为每个选定的段添加控制器。对于每个段,都有一个表视图。问题是:当我从这个tableview中选择一行时,我无法执行下一个控制器的推送操作,因为self.navigationController为null 请帮助我……这是我的代码: 如果没有代码:Iphone pushviewcontroller不工作,因为self.navigationController为空,iphone,uitableview,uinavigationcontroller,Iphone,Uitableview,Uinavigationcontroller,我有一个大问题:在didselectrowatinexpath方法上,self.navigationController的值总是为null。我有一个UIViewController,它包含一个UIsegmentedControl和一个子视图。在此子视图上,我为每个选定的段添加控制器。对于每个段,都有一个表视图。问题是:当我从这个tableview中选择一行时,我无法执行下一个控制器的推送操作,因为self.navigationController为null 请帮助我……这是我的代码: 如果没有代
navigationTelephone=[[UINavigationController alloc] init];
[self.view addSubview:self.navigationTelephone.view];
[self.navigationTelephone setNavigationBarHidden:YES];
[self.view addSubview:tableViewTelephone];
我想您已经初始化了UINavigationController,如下所示
[[UINavigationController alloc] initWithRootViewController:ViewControllerOBj]
更新:
初始化实例变量NavigationPhone并显示它,但使用self.navigationController推送!
改用[NavigationPhone push…]试试这个:
- (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];
Naveen Shan您的应用程序基于导航或任何其他基于导航的应用程序i编写的导航电话=[[UINavigationController alloc]initWithRootViewController:self.myaudico或onneesviewcontroller];但我得到的应用程序试图在目标上推一个无视图控制器,我有它,但它不工作…不是推到下一个视图控制器