0

我是iOS開發新手。 我有一個導航控制器故事板和UIViewController連接到它。來自UIPageViewController的navigationController pushViewController不工作

UIViewController自定義類,我添加三個UIViewControllerUIPageViewController

_one= [self.storyboard instantiateViewControllerWithIdentifier:@"View1"]; 
_two = [self.storyboard instantiateViewControllerWithIdentifier:@"View2"]; 
_three = [self.storyboard instantiateViewControllerWithIdentifier:@"View3"]; 
_page = [[CustomUIPageViewController alloc] initWithParentViewController:self]; 
_page.viewControllers = @[_one, _two, _three]; 
[self.view addSubview:_page.view]; 
... 

我想通過調用顯示從頁面_TWO視圖驗證碼:

ResultViewController *view = [self.storyboard instantiateViewControllerWithIdentifier:@"ResultBoard"]; 
     [self.navigationController pushViewController:view animated:YES]; 

但它不工作,我也嘗試:

[self.parentViewController.navigationController pushViewController:view animated:YES]; 
+0

哪個視圖顯示? –

+0

@ S.Jain這是一個UIViewController的故事板頁面。 – DzungPV

回答

0

我可以解決我的PROBL他們現在。這不是一種「乾淨」的方式,但它的工作。 在_TWO控制器我補充一下:

@property (weak, nonatomic) UINavigationController *navigationCustomController; 

然後初始化當我添加:

_two.navigationCustomController = self.navigationController; 

從那以後,我只要致電:

ResultViewController *view = [self.storyboard instantiateViewControllerWithIdentifier:@"ResultBoard"]; 
[_navigationCustomController pushViewController:view animated:YES]; 

而且它的工作。

相關問題