0

ボタンを押した後、コンソールにこのエラーが表示されます。

< 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];}

最初のViewControllerはUITableViewControllerです

私は自分自身をに設定しようとしました[self.tabBarController presentModalViewController:tabbar1 animated:YES];

それでも同じ

何か案が ?

アップデート :

私は解決策を見つけました、私はちょうどこのコード行を削除しました

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

そして、すべてがうまくいきました:)

4

1 に答える 1

1

コード[self.view insertSubview:tabbar1.view belowSubview: first.view];に意味はありません。オブジェクトfirstがロードされなくなったためです。したがって、そのステートメントは無効です。そのコードを削除して続行します。

于 2012-07-11T03:47:27.337 に答える