AlertController(.actionSheet) и iPad


#1

Подскажите пожалуйста? можно ли как-нибудь заставить работать AlertController(.actionSheet) на iPad?


#2
let actionSheetController: UIAlertController = UIAlertController(title: "SomeTitle", message: nil, preferredStyle: .actionSheet)

let editAction: UIAlertAction = UIAlertAction(title: "Edit Details", style: .default) { action -> Void in
    print("Edit Details")
}

let deleteAction: UIAlertAction = UIAlertAction(title: "Delete Item", style: .default) { action -> Void in
    print("Delete Item")
}

let cancelAction: UIAlertAction = UIAlertAction(title: "Cancel", style: .cancel) { action -> Void in }
actionSheetController.addAction(editAction)
actionSheetController.addAction(deleteAction)
actionSheetController.addAction(cancelAction)

actionSheetController.popoverPresentationController?.sourceView = yourSourceViewName

present(actionSheetController, animated: true) {
    print("option menu presented")
}

#3

Огромное спасибо, всё заработало как положено!


#4

На здоровье ) Обращайтесь