2016-02-20 145 views
0

的結構是這樣的嵌入導航控制器隱藏在視圖控制器導航項目

標籤欄控制器 - >導航欄(項目) - >視圖控制器(在右手側的一些按鈕。當我只使用導航欄它被正確地工作,但現在的導航欄是越來越與空白的導航欄替換

override func viewWillAppear(animated: Bool) { 

    currentUserId = PFUser.currentUser()!.objectId! as String 
     self.navigationController?.setToolbarHidden(true, animated: true) 
    if (isSegue == "CurrentUser") 
    { 
     UserId = PFUser.currentUser()!.objectId! as String 
     self.navigationItem.title = "My Album"    
    } 
    else 
    { 
     self.navigationItem.title = userName 
     self.navigationItem.rightBarButtonItems = nil 
    } 

    //added to make navigation bar black - Subodh 
     let nav = self.navigationController?.navigationBar 
    var image = UIImage(named: "xxxxxxx") 
    image = image?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) 

    self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: image, style: UIBarButtonItemStyle.Done, target: self, action: "leftBarButtonPressed") 
     nav?.barStyle = UIBarStyle.Black 
     nav?.tintColor = UIColor.whiteColor() 
     self.navigationController!.toolbar.barTintColor = UIColor.blackColor(); 
     self.navigationController?.hidesBarsOnTap = false 

    self.tabBarController?.hidesBottomBarWhenPushed = true 

    self.collectionView.reloadData() 

} 

在視圖控制器

,導航欄的屬性是從加載。導航上有兩個按鈕酒吧,當我運行代碼時不顯示。我試圖從標籤視圖控制器隱藏導航欄self.tabBarController?.hidesBottomBarWhenPushed = true ,但它不工作。也爲tabcontroller我只能設置標題不是其他的東西。所以我該如何處理?

回答

0

得到它的工作通過包括這viewDidLoad中:

self.tabBarController?.navigationController?.navigationBarHidden = true