UIAlertController is Crashed (iPad)

后端 未结 10 1720
长情又很酷
长情又很酷 2020-12-13 17:58

I am using Xcode 6 to develop an iOS Application.

When I used UIAlertController, it can be worked well on iPhone 6 simulator, but crashes on iPad simula

10条回答
  •  时光说笑
    2020-12-13 18:40

    for iOS 13

    used it.

     if #available(iOS 13.0, *) {
                if let popoverPresentationController = actionSheet.popoverPresentationController {
                    popoverPresentationController.sourceView = self.view
                    popoverPresentationController.sourceRect = sender.frame
                }
                self.present(actionSheet, animated: true, completion: nil)
            } else {
                actionSheet.popoverPresentationController?.sourceView = self.view
                actionSheet.popoverPresentationController?.sourceRect = sender.frame
    
                actionSheet.show()
            }
    

提交回复
热议问题