Reputation:
When I try to create segue via storyboard it's only does open new view controller as pop out instead of fullscreen. I tried changing kind of segue from ,,Show (e.g. Push)" to others but then I get "Thread 1: signal SIGABRT"
Upvotes: 9
Views: 5390
Reputation: 171
You need to select present modally
for the segue type
and then right below select the presentation style full screen
:
Upvotes: 16
Reputation: 3064
What you need to do is set the destination view controller's modalPresentationStyle
to fullscreen
by way of prepareForSegue:sender:
:
class FirstViewController: UIViewController {
...
@IBAction func segueButtonPressed(_ sender: Any) {
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)
if let secondViewController = segue.destination as? SecondViewController {
secondViewController.modalPresentationStyle = .fullScreen
}
}
}
prepareForSegue:sender:
is called before a segue is performed from a UIViewController
. The default modalPresentationStyle
in iOS 13+ is .pageSheet
, which is the presentation that doesn't cover the whole screen (though it allows for more natural navigation/dismissal via swiping the view controller down and off the screen). We need to change this modalPresentationStyle
to .fullScreen
before performing the segue.
Upvotes: 10