2017-08-08 10 views
0

表示TabBarControllerは、ユーザーnavigationから別のUIViewControllerになります。UITabBarControllerが別のUIViewControllerにナビゲートした後で無効になる

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
CategoryViewController *categoryViewController = [storyBoard instantiateViewControllerWithIdentifier:@"CategoryViewController"]; 
[self.tabBarController.navigationController pushViewController:categoryViewController animated:YES]; 

UIViewControllerクラスすなわち、CategoryViewControllertabbarcontrollerが消滅へUITabBarControllerからナビゲートした後、私は別のcontrollerからUITabBarControllerでもそのナビゲートを示したいと思います。

+0

は、なぜあなたはタブバーコントローラにプッシュしたいですされている使用する必要がある問題を解決するには?選択したビューのナビゲーションコントローラ内をナビゲートできます。 –

+1

'UINavigationController'のビュー階層に' UITabBarController'があるようです。他のビューコントローラをスタックに 'プッシュ 'すると*もちろん、' UITabBarController'が押し出されます。デザインは後ろ向きになっているか、階層をどのようにセットアップしたかを示す必要があります。 – DonMag

+0

単純に使用 [self.navigationController pushViewController:categoryViewController animated:YES]; –

答えて

-1

あなたのタブバー

[self.tabBarController.navigationController pushViewController:categoryViewController animated:YES]; 

あなたの次のビューコントローラをプッシュします上記の行の場所であなたの次のビューコントローラをプッシュしています。

あなたはナビゲーションコントローラに(選択したタブに表示されている)あなたの現在のビューコントローラを埋め込み、

[self.navigationController pushViewController:YOUR_VIEWCONTROLLER animated:YES]; 
+0

あなたは 'navigationController'に' tabBar'があることを理解する必要がありますので、投稿する前にコードをテストしてください! –

+1

@AnuragSharma - コードの上の行を読んでください。彼が次のビューコントローラにプッシュしている現在のビューコントローラは、ナビゲーションコントローラに埋め込むように指示しました。 –

+1

[self.navigationController]は、現在のビューコントローラがタブバーのナビゲーションコントローラではないナビゲーションコントローラを参照します。 –

関連する問題