按下按钮后,我在控制台中收到此错误。
对<开始/结束外观转换的不平衡调用UITabBarController:0xcb3a330>。
我的代码是
-(IBAction)push:(id) sender {
UITabBarController *tabbar1 = [[UITabBarController alloc] init];
firstViewController *first = [[firstViewController alloc] initWithNibName:@"firstViewController" bundle:nil];
UINavigationController *tabItem1 = [[UINavigationController alloc] initWithRootViewController: first];
secondViewController *second = [[secondViewController alloc] initWithNibName:@"secondViewController" bundle:nil];
UINavigationController *tabItem2 = [[UINavigationController alloc] initWithRootViewController: second];
tabbar1.viewControllers = [NSArray arrayWithObjects:tabItem1, tabItem2,nil];
[self.view insertSubview:tabbar1.view belowSubview: first.view];
[self presentModalViewController:tabbar1 animated:YES];}
fisrtViewController是UITableViewController
我尝试将自己设置为[self.tabBarController presentModalViewController:tabbar1 animated:YES];
但仍然相同
任何想法?
更新:
我找到了解决方案,我刚刚删除了这行代码
[self.view insertSubview:tabbar1.view belowSubview: first.view];
一切都很顺利:)。
答案 0 :(得分:1)
代码[self.view insertSubview:tabbar1.view belowSubview: first.view];
没有任何意义。因为,不再加载对象first
。因此该声明无效。删除该代码并继续。