let obj = MainStoryboard().instantiateViewController(withIdentifier: "SomeVC") as! SomeVC
obj.delegate = self
obj.modalPresentationStyle = .popover
obj.popoverPresentationController?.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
self.present(obj, animated: true, completion: nil)
关于设置断点,调试器进入最后一行。之后,它直接进入AppDelegate
班的第一线。Swift3:在弹出时出现崩溃
我已经正确设置了异常中断点。我可能在哪里犯错误?是否与sourceView
有关popoverPresentationController
?我不确定。
我想要做的是在中心设置popoverPresentationController
。任何帮助?
编辑: 我加入了sourceView
的代码像下面&现在它的工作:
obj.popoverPresentationController?.sourceView = self.view
obj.popoverPresentationController?.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 1, height: 1)
然而,这是不是在屏幕的中央。把屏幕截图作为参考。我如何将它放到中心并移除方向箭头?
任何崩溃报告? – raki
在控制台中,没有。除了:'libC++ abi.dylib:终止于类型为NSException的未捕获异常' –
显示完整的崩溃报告 –