2017-07-17 93 views
0

我在iOS中整合了統一,並且運行良好。但有意想不到的導航欄項目。如何隱藏該導航項目或將其刪除,以便我可以顯示我的首選項目。從統一導出項目隱藏導航項目:iOS

下面是該項目的形象:

enter image description here

我也不知道他是怎麼得到這個名字。 從故事板中刪除導航項目後,該項目在那裏,但沒有任何名稱。 這裏是代碼:

@property (nonatomic, strong) UINavigationController *navigationController; 



UIStoryboard *storyBoard; 
    storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 

    _rootController   = [[UnityPortraitOnlyViewController alloc] init]; 
    _rootView    = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    _rootController.view = _rootView; 

    ViewController *mainVC  = [storyBoard instantiateViewControllerWithIdentifier:@"ViewController"]; 

    self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainVC]; 

    [_rootView addSubview:self.navigationController.view]; 
+0

什麼是黑色的背景?你想隱藏那個? – KKRocks

+0

@KKRocks否我想隱藏白色導航條 –

+0

在initwithrootViewController後添加此行 - self.navigationController.navigationBarHidden = YES; self.navigationController.navigationBar.translucent = NO; – KKRocks

回答

1

試試這個:

self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainVC]; 
self.navigationController.navigationBarHidden = YES; 
self.navigationController.navigationBar.translucent = NO;