dismissViewControllerAnimated在当前动画完成之前启动

时间:2014-06-17 09:39:39

标签: ios objective-c uiviewcontroller

我有一个UIViewController对象,由segue事件呈现 此对象处理条形码扫描并启动dismissViewControllerAnimated方法以返回到先前的视图控制器 如果立即扫描条形码(在segue动画完成之前self.isBeingPresented == true),则dismissViewControllerAnimated无法运行

(Warning: Attempts to dismiss view controller <SearchBarcodeViewController: 0x155d4720> while a presentation or dismiss is in progress!)

如何在致电dismissViewContorllerAnimated之前延迟dismissViewContorllerAnimated来电或取消演示动画?

1 个答案:

答案 0 :(得分:0)

您应该只在显示视图后运行条形扫描代码,以确保它在此之前不扫描条形码。

所以说你的条形码扫描代码会在viewDidLoad上运行。您应该将其移至viewDidAppear