我有一个视图,它有两个子视图,在标签栏中添加这两个子视图时,它在主视图中崩溃。以下是代码..
block_list = [[ofi_vc_blocked_list alloc] init];
ab_blk_navig_controller = [[UINavigationController alloc] initWithRootViewController:block_list];
ab_navig_controller = [[UINavigationController alloc] initWithRootViewController:ab_window];
ab_tab_bar = [[UITabBarController alloc] init]; // ab_tab_bar is tab bar controller
ab_tab_bar.viewControllers = [NSArray arrayWithObjects:ab_navig_controller, ab_blk_navig_controller, nil];
这样做时,它会崩溃并出现以下错误:
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<ofi_vc_address_book: 0x6868710> should have parent view controller:<ofi_vc_main_page_controller: 0x6c4b830> but actual parent is:<UITabBarController: 0x6869830>'
有什么想法吗?