01 - Pushing a navigation controller is not supported
阿新 • • 發佈:2019-01-08
01 - Pushing a navigation controller is not supported
報錯描述
- 前提 : 自定義storyboard:包含一個navigationController與UIViewnController
- 理想現象 : 用Button跳轉至自定義storyboard
- 報錯reason : Pushing a navigation controller is not supported
- 解決方式 : Storyboard EntryPoint(即進入storyboard的箭頭)直接指向與UIViewnController
跳轉Code:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"PersonOfDetail" bundle:nil];
UIViewController *nav = [storyboard instantiateInitialViewController];
[self.navigationController pushViewController:nav animated:YES];
分析:
將VIewController push到一個NavigationController中,相當於一個入棧操作;
如果push的物件中也有繼承自UINavigationController,則存在NavigationController管理NavigationController物件;
存在衝突,於是就報錯;
修改方法:
被push的物件不要繼承UINavigationController即可