I want my iphone alert to look like the ipad alert
code:
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)
What can I add to the code above to have the iphone alert look like the ipad alert?
Alert are only able to be shown from the bottom of the view/window on the iPhone. Try using an 3rd party alert view. Look here: https://www.cocoacontrols.com/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.