簡體   English   中英

如何在所有UIViewControllers中顯示選項卡欄控制器

[英]how to display Tab Bar Controller in all UIViewControllers

我的iPhone應用程序顯示帶有3個選項卡的選項卡欄。單擊。 最初的3個UIViewControllers都可以正常工作。 但是,當我嘗試在任何TAB中推送新的UIViewController時,選項卡欄消失了。 我什至嘗試了這里提到的其他解決方案http://stackoverflow.com/questions/31087181/tab-bar-controller-is-not-in-all-uiviewcontrollers但是,我只能看到沒有選項卡欄選項的空白...

在此處輸入圖片說明

我嘗試不使用導航以正常方式推送UIViewController的導航。 我還從選項卡欄(具有UIViewController導航控制器)中推送UIViewController ,但是任何一種方式都無法給我期望的結果。 我不希望有兩個導航項或沒有選項卡欄的情況下推送新視圖。

所有UIViewController都應顯示在一個導航和選項卡欄中。

請幫忙

注意:我從家庭uiviewcontroller上的按鈕單擊加載TABBar

喜歡

    -(IBAction)btnReceivePressed:(id)sender
 {
     TabBarViewController *about_vc = (TabBarViewController*)[[UIStoryboard   storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"TABBAR"];
     [[self navigationController] pushViewController:about_vc animated:YES];
 }

下面是顯示兩個導航項目的屏幕截圖。 在此處輸入圖片說明 ] 3 [ 在此處輸入圖片說明 ] [4 在此處輸入圖片說明

嘗試以下方法獲取UIViewcontroller的set屬性:

在此處輸入圖片說明

兩個導航欄的另一種解決方案

您需要按以下方式更改appdelgate:

來自:

 UINavigationController *naController =[[UINavigationController alloc ]initWithRootViewController:self.tabBarController];
  naController.navigationBarHidden = NO;
  self.window.rootViewController = naController;

與:

self.window.rootViewController = self.tabBarController;

第三種解決方案如果您使用push。

- (IBAction)btnReceivePressed:(id)sender {
    TabBarViewController about_vc = (TabBarViewController)
    [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"TABBAR"]; 
    [self navigationController].navigationBarHidden = YES;
    [[self navigationController] pushViewController:about_vc animated:YES];
 } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM