问题
I've got this problem. I want the view controller to change when the player presses a specific button. So I added a new "view controller" in the main storyboard, I customised it and then, holding the right button of the mouse, I dragged the button on the new view controller. It appeared a little menu with different items:
- show
- show detail
- present modally
- present as a popover
- custom
I've tried all of them, nothing changed (except for the last one: the app crashes). The new view controller is like a moving window, if you swipe down you go back to the start menu. What I want is that the new window replaces the first one.
Here's the problem
As you can see, the brown window is movable
回答1:
As I understand you need to present view controller full screen.
You need to select "present modally" segue type. Then select segue in storyboard
And then select presentation style "Full screen"
Or you can make this programmatically:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let nextVC = storyboard.instantiateViewController(withIdentifier: "nextVC") as! NextVCClass
nextVC.modalPresentationStyle = .fullScreen
self.present(nextVC, animated: true)
来源:https://stackoverflow.com/questions/59518827/how-to-change-the-segue-type-of-the-storyboards