Iphone上的警报显示与Ipad不同

时间:2015-10-15 17:56:35

标签: ios swift

我希望我的iphone警报看起来像ipad警报

enter image description here

代码:

    let alertController = UIAlertController(title: "Appcoda", message: "Message in alert dialog", preferredStyle: UIAlertControllerStyle.ActionSheet)

    let deleteAction = UIAlertAction(title: "Delete", style: UIAlertActionStyle.Destructive, handler: {(alert :UIAlertAction) in
        print("Delete button tapped")
    })
    alertController.addAction(deleteAction)

    let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: {(alert :UIAlertAction) in
        print("OK button tapped")
    })
    alertController.addAction(okAction)

    alertController.popoverPresentationController?.sourceView = view
    alertController.popoverPresentationController?.sourceRect = sender.frame

    presentViewController(alertController, animated: true, completion: nil)

我可以在上面的代码中添加什么来让iphone警报看起来像ipad警报?

1 个答案:

答案 0 :(得分:0)

警报只能从iPhone上的视图/窗口底部显示。尝试使用第三方警报视图。看这里:https://www.cocoacontrols.com/