How to change the segue type of the storyboards

旧巷老猫 提交于 2020-11-29 10:36:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!