我有一个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
来电或取消演示动画?
答案 0 :(得分:0)
您应该只在显示视图后运行条形扫描代码,以确保它在此之前不扫描条形码。
所以说你的条形码扫描代码会在viewDidLoad
上运行。您应该将其移至viewDidAppear