I want to display a ViewController that is filled with a tableView as a popover when a UIMenuItem is tapped. Is this possible? I have done the following in the function that is called when the respecting menu item is tapped:
func pickColor(sender: UIMenuItem) {
self.performSegue(withIdentifier: "ColorPopOver", sender: view)
}
Then I have implemented the methods that handle the segue and presentation of the popover:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "ColorPopOver" {
let destinationController = segue.destination
if let popOver = destinationController.popoverPresentationController {
popOver.delegate = self
}
}
}
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
When the pickColor method is called the app crashes, can someone tell me what am I doing wrong? Or is it just impossible? Thanks.