Ios Iphone上的警报显示与Ipad上的不同
我希望我的iphone提醒看起来像ipad提醒 代码:Ios Iphone上的警报显示与Ipad上的不同,ios,swift,Ios,Swift,我希望我的iphone提醒看起来像ipad提醒 代码: 我可以在上面的代码中添加什么使iphone警报看起来像ipad警报 警报只能在iPhone的视图/窗口底部显示。尝试使用第三方警报视图。看这里:由于屏幕面积小,苹果选择在底部显示UIAlertView。您需要一个 let alertController = UIAlertController(title: "Appcoda", message: "Message in alert dialog", preferredStyle:
我可以在上面的代码中添加什么使iphone警报看起来像ipad警报 警报只能在iPhone的视图/窗口底部显示。尝试使用第三方警报视图。看这里:由于屏幕面积小,苹果选择在底部显示UIAlertView。您需要一个
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)