提交app时,如果苹果那边是用pad测试,点到了UIAlertController,可能会报错,拒绝原因

错误提示:

Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller’s popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.

Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet.Your application has presented a UIAlertController of style UIAlertControllerStyleActionSheet.

也就是说iphone有的样式,ipad不一定有。

更改方法,就是在present之前叫一个判断,做出不同样式的布局,苹果已经为我们提供好了方法

{

       ……

      if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad {

            actionSheet.popoverPresentationController?.sourceView = self.view //要展示在哪里

            actionSheet.popoverPresentationController?.sourceRect = self.headerV.nameLb.frame //箭头指向哪里

        }

        present(actionSheet, animated: true, completion: nil)

}

相关文章:

  • 2021-08-05
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-08-07
  • 2021-10-10
  • 2022-02-16
  • 2021-07-13
相关资源
相似解决方案