I\'m using ActionSheet in my application. On my iPhone it works, but it doesn\'t on the iPad simulator.
this is my code:
@IBAction func dialog(send
Swift 3
As said before, you should configure UIAlertController to be presented on a specific point on iPAD.
Example for navigation bar:
// 1
let optionMenu = UIAlertController(title: nil, message: "Choose an option", preferredStyle: .actionSheet)
// 2
let deleteAction = UIAlertAction(title: "Option 1", style: .default, handler: {
(alert: UIAlertAction!) -> Void in
print("option 1 pressed")
})
let saveAction = UIAlertAction(title: "Option 2", style: .default, handler: {
(alert: UIAlertAction!) -> Void in
print("option 2 pressed")
})
//
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
// 4
optionMenu.addAction(deleteAction)
optionMenu.addAction(saveAction)
optionMenu.addAction(cancelAction)
// 5
optionMenu.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem
self.present(optionMenu, animated: true) {
print("option menu presented")
}