2015-10-23 75 views
1

我有一個提供導航控制器的選項卡欄控制器。在其中一個ViewController中,我將其添加到頂部,添加imagePickerController以選擇一張照片。當我取消或選擇一張圖片的標籤欄消失...我試圖尋找答案,但我找不到一個引用我的具體問題。ImagePicker解除tabBar導航控制器

這裏是我的圖片選擇器方法

@IBAction func attachImageBtnTapped(sender: AnyObject) { 
     if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){ 
      imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary 
      imagePicker.modalPresentationStyle = UIModalPresentationStyle.CurrentContext 
      self.presentViewController(imagePicker, animated: true, completion: nil) 
     } 
    } 

    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { 
     attachImageBtn.backgroundColor = UIColor.greenColor() 
     dismissViewControllerAnimated(true, completion: nil) 
    } 

我怎樣才能避免這種情況?我想看看如果我設置塔巴爾在viewWillAppear中,但第

任何想法在某處被隱藏的喜歡,任何幫助將非常感謝!

+0

我點擊取消的TabBar幻燈片的那一刻(動畫)跌 – KML

+0

@馬特它沒有隱藏.... – KML

+0

如果self.tabBarController?.tabBar.hidden ==真{ 打印( 「隱藏」) } else { print(「not hidden」) } – KML

回答

4

我發現了錯誤,我需要呈現imagePicker控制器「OverCurrentContext」。

@IBAction func attachImageBtnTapped(sender: AnyObject) { 
     if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){ 
      imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary 
      imagePicker.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext 
      self.presentViewController(imagePicker, animated: true, completion: nil) 
     } 
    }