UIModalPresentationStyle.FullScreen behaviour

Hello, when I do something like


navController.modalPresentationStyle = UIModalPresentationStyle.FullScreen


the popover spans the entire screen with no automatic "< Back" button. How is the user supposed to get back to the parent view? In the simulator I have tried clicking everywhere on the popover but I could find no way to dismiss the popover. Does that mean I need to put in a button to allow that? If so what method do I call to get back to parent view?


Fyi, my parent view is a tableView and the popover is generated when a tableViewCell is tapped via


func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {...}


Thanks

Answered by rsharp in 150529022

Full-screen modal view controllers will need some way to dismiss them; usually with a button. Or, depending upon the situation, you can also set up say a tap gesture recognizer such that a tap would dismiss the view controller.


In either case, you dismiss the view controller like:


//Swift >= 3
dismiss(animated: true, completion: nil)

//Swift <= 2.3
dismissViewControllerAnimated(true, completion: nil)
Accepted Answer

Full-screen modal view controllers will need some way to dismiss them; usually with a button. Or, depending upon the situation, you can also set up say a tap gesture recognizer such that a tap would dismiss the view controller.


In either case, you dismiss the view controller like:


//Swift >= 3
dismiss(animated: true, completion: nil)

//Swift <= 2.3
dismissViewControllerAnimated(true, completion: nil)

Thanks, rsharp.

UIModalPresentationStyle.FullScreen behaviour
 
 
Q