2012-07-10 59 views
0

我按下按钮后,在控制台中出现此错误。Tabbar不平衡单元

对于< 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];

,但还是一样

什么想法?

UPDATE:

我找到了解决办法,我只是删除这行代码

[self.view insertSubview:tabbar1.view belowSubview: first.view]; 

,一切都只是罚款:)

+1

remove [self.view insertSubview:tabbar1.view belowSubview:first.view];将解决问题 – aLFaRSi 2012-07-10 23:04:43

+0

后,并接受作为答案。 – CodaFi 2012-07-10 23:05:56

回答

1

代码[self.view insertSubview:tabbar1.view belowSubview: first.view];没有任何意义。因为,对象first不再加载。因此,该陈述是无效的。删除该代码并继续。