【发布时间】:2015-09-25 22:43:03
【问题描述】:
我在屏幕上显示了一个UIImagePickerController。当我选择照片时,我需要关闭PickerController,然后立即展示另一张PhotoEditController。这是我的代码
picker.dismissViewControllerAnimated(false, completion: {
self.presentViewController(editPhotoVC, animated: false, completion: nil)
})
在关闭旧 VC 和呈现新 VC 之间有 0.1 秒的闪烁,因此显示了 presentingViewController (self)。我如何在一个优雅的解决方案中避免这种情况而不是破解它?谢谢
【问题讨论】:
-
既然你没有为任何东西设置动画,为什么不直接展示视图控制器而不关闭前一个呢?
If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. -
怎么样?苹果不允许这样做
-
对不起,我的意思是在已经呈现的视图控制器(选择器)上呈现你的新视图控制器。然后,当您想要全部关闭它们时,请从呈现第一个视图控制器的原始视图控制器中关闭。
-
picker.dismissViewControllerAnimated 对吗?不应该只是dismissViewControllerAnimated吗?
-
@LLooggaann 我明白你的意思。这实际上是我实施的。我在 self 上实现了来自 editPhotoVC 的委托回调,以将两个视图控制器一起解除。你应该写一个答案,我会标记为已回答。
标签: ios iphone swift presentviewcontroller