我的应用程序正在使用 pushViewController 以模态方式显示导航控制器
[navigationController pushViewController:_viewController animated:YES];
导航控制器已完成按钮
UIButton* backButton = [UIButton buttonWithType:101];
[backButton addTarget:self action:@selector(dismissView:) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:@"Done" forState:UIControlStateNormal];
UIBarButtonItem* backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = backItem;
[backItem release];
按下完成按钮后,我希望它应该导航回主窗口
-(void) dismissView: (id)sender
{
[self.navigationController popToRootViewControllerAnimated:YES];
//[self.navigationController popToViewController:_viewController animated:YES];
}
但是当我按下完成按钮时,什么也没有发生。这是为什么?