2012-07-10 91 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不再加載。因此,該陳述是無效的。刪除該代碼並繼續。