【问题标题】:Unbalanced calls to begin/end appearance transitions for <ViewController><ViewController> 开始/结束外观转换的不平衡调用
【发布时间】:2016-10-14 12:09:34
【问题描述】:

我得到错误:

“开始/结束外观转换的不平衡调用”。

在我的应用程序中,您从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
    }
}

【问题讨论】:

    标签: ios swift xcode swift3 unwind-segue


    【解决方案1】:

    尝试在completion 中的performSegue dismiss(animated:)

    self.dismiss(animated: false) { 
          performSegue(withIdentifier: "unwindToExpenseView", sender: self)
    }
    

    【讨论】:

      猜你喜欢
      • 2022-10-20
      • 2016-01-30
      • 2021-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-22
      • 2012-07-11
      相关资源
      最近更新 更多