0

在NavigationController和tabBarController下有3個UIViewController。在NavigationController和tabBarController下使用UIImagePickerController時出錯

推這樣的viewControllers:A-> B->Ç

在的viewController C,添加以下代碼,讓用戶從照片庫中選擇圖像。

func btnClicked() { 
    let imagePickerController = UIImagePickerController() 
    imagePickerController.sourceType = .photoLibrary 
    imagePickerController.delegate = self 
    self.present(imagePickerController, animated: true, completion: nil) 
} 


func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { 
    if let image = info[UIImagePickerControllerOriginalImage] as? UIImage{ 
     topIamge.image = image 
    } 

    picker.dismiss(animated: false, completion: nil) 

} 

問題是,用戶選擇一個圖像或取消選擇後,然後按下左欄按鈕回到B,錯誤Unbalanced calls to begin/end appearance transitions for顯示時,如果繼續回到A,錯誤被打印出再次。

我做錯了什麼?

P.S.如果我按下後退按鈕而不顯示UIImagePickerController,則不會出現錯誤。

Thx。

回答

相關問題