Swift UIAlertController -> ActionSheet iPad iOS8 Crashes

前端 未结 8 1471
北恋
北恋 2020-12-02 12:20

currently i\'m running into big trouble with my ActionSheet. On iPhone it works great, but on iPad it only crashes

I create a new project with only one button

<
8条回答
  •  無奈伤痛
    2020-12-02 12:40

    To follow up on Nate Cook's answer. If your button is a UIBarButtonItem it may be necessary to perform casting on sender.

    if let popoverController = alertController.popoverPresentationController {
        popoverController.barButtonItem = sender as! UIBarButtonItem
    }
    self.presentViewController(alertController, animated: true, completion: nil)
    

提交回复
热议问题