I have my application set up to segue to another NewHelpRequestViewController
by clicking on the last cell in an array. What I am wanting to do is open up the view controller as a popover instead.
class MainViewController : UITableViewController, UIPopoverPresentationControllerDelegate {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
if indexPath.row == questionViewCellArray.count-1 {
self.performSegue(withIdentifier: "showNewRequest" , sender : self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showNewRequest" {
if let controller = segue.destination as? NewHelpRequestViewController {
controller.popoverPresentationController!.delegate = self
controller.preferredContentSize = CGSize(width: 200, height: 300)
}
}
}
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .none
}
Right now it will open NewHelpRequestViewController
without any issues or errors. I linked what relevant code I could. If I need to show anything else, please let me know.
I should also mention that this is for an iphone.