Page views not correctly sized after segue

会有一股神秘感。 提交于 2019-12-20 06:24:17

问题


I recently updated my XCode to version 11.0. Ever since the update segues on an old project have been behaving weirdly. When I segue modally to a new page the page does not fill the entire screen and seemingly hovers instead.

Here is a picture of the view: https://imgur.com/dAxEr4q

I would like for the pages to take up the full length of the device screen as they did prior to the upgrade.

Thanks in advance for any assistance.


回答1:


This has to do with the new default modal presentation style in iOS 13.
To set the prior behavior, you need to change the presentation style to full screen.

You can do this both in storyboard by editing your segue's Presentation attribute and setting it from Automatic to Full Screen:

Alternatively, if you are presenting your View Controller programmatically, you can set your View Controllers modalPresentationStyle before presenting it, like so:

let detailController = /* your View Controller */
detailController.modalPresentationStyle = .overFullScreen
present(detailController, animated: true, completion: nil)



回答2:


So the solution turned out to be more obvious than I realized. If you click on the segue symbol on the storyboard some options are displayed in the side bar.

Selecting presentation -> full screen from the drop down fixed my issue.

Adding a screenshot for clarity: https://imgur.com/BRCbx5k

Hope this helps anyone else having segue problems :)




回答3:


You can programmatically present the controller like in below code :

let vc = secondStoryBoard.instantiateViewController(withIdentifier: "SearchNavVC") vc.modalPresentationStyle = .fullScreen vc.modalTransitionStyle = .crossDissolve self.present(vc, animated: true, completion: nil)



来源:https://stackoverflow.com/questions/58105710/page-views-not-correctly-sized-after-segue

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