我得到错误:
"Unbalanced calls to begin/end appearance transitions for ”.
在我的应用程序中,您从 tableViewController
开始,如果您单击底部的照片图标,相机会弹出,当您拍摄照片时,您会通过 navigationController
> 进入编辑viewController
。从这里,如果您单击图像,您将被发送到预览 viewController
。
我的问题是,如果我在编辑现有项目时单击“新照片”,它工作正常,但如果我在我刚刚创建(但尚未保存)的项目上单击“新照片”,我会被一路发送回到最初的tableViewController
我的代码是这样的:
// Called when the user finishes taking a photo.
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
// The info dictionary contains multiple representations of the image, and this uses the original.
image = info[UIImagePickerControllerOriginalImage] as? UIImage
// Dismiss the picker.
dismiss(animated: false, completion: nil)
performSegue(withIdentifier: "unwindToExpenseView", sender: self)
}
在我编辑viewController
@IBAction func unwindToExpenseView(sender: UIStoryboardSegue) {
if let ImagePreviewer = sender.source as? ImagePreviewViewController {
photoImageView.image = ImagePreviewer.image
}
}
最佳答案
尝试在 dismiss(animated:)
的completion
中performSegue
。
self.dismiss(animated: false) {
performSegue(withIdentifier: "unwindToExpenseView", sender: self)
}
关于ios - 对 <ViewController> 开始/结束外观转换的不平衡调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40042835/