从呈现的模态视图调用导航方法时出现问题。我有三个视图控制器,HomeViewController、loadViewController、modalViewController。
modalViewController 通过按下按钮从 HomeViewController 呈现为模式视图。实际上我需要的是,当我从呈现的 modalViewController 按下一个按钮时,模式视图应该被关闭并且 HomeViewController 应该导航到 loadViewController。它不适用于我的代码,
主视图控制器.m
- (IBAction)shortCutButtonPressed:(id)sender {
ShortCutViewController *viewController=[[ShortCutViewController alloc]initWithNibName:nil bundle:nil];
[self.navigationController presentModalViewController:viewController animated:YES];
[viewController release];
}
-(void)loadViewControllerLoad
{
loadViewController *loadView=[[loadViewController alloc]initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:loadView animated:YES];
[loadView release];
}
modalViewController.m
//modal view controller 会从 HomeViewController 调用函数 loadViewControllerLoad 来导航 homeview 到 loadView。函数调用正确到达,但视图未导航到 loadView
- (IBAction)HomeButtonPressed:(id)sender {
homeView=[[HomeViewController alloc]initWithNibName:nil bundle:nil];
[homeView loadViewControllerLoad];
[[self presentingViewController] dismissModalViewControllerAnimated:YES];
[homeView release];
}
函数调用到达 HomeViewController 但视图没有导航到 LoadView?