segue shrinks viewcontroller. how to keep “normal” size

旧巷老猫 提交于 2019-12-24 19:53:10

问题


Setup embedded viewcontroller tabs using UISegmentedControl and embedded ViewControllers (as in this example: https://ahmedabdurrahman.com/2015/08/31/how-to-switch-view-controllers-using-segmented-control-swift/)

Its all good. The tabs work. The UI changes. BUT, when I touch a button in one of the embedded VC's then I want to launch yet another ViewController ("Z". Simple enough? NO! In Interface Builder, when I add the segue to the "Z" controller then IB automatically resizes it in the storyboard. It shrinks to the size of the View associated with the UISegmentedControl.

Is there some setting in IB to tell it to make this "Z" control back to normal size? Its messed up when I run it in the simulator too: stuff gets cut off, unless I put a spring to the bottom of the screen.

And/or is there something I can do on the segue or something so it doesn't shrink the target ViewController when I drag the seque to it?

Original size of "Z" ViewController: Top VC is from the View for the UISegmentedControl. Second VC is the embedded VC. Third is the "Z", the one embedded should launch.

Drag Segue and it becomes as small as the view on the original ViewController (A). (A embeds B, the B segues to Z). Note: Simulated Size: Fixed I can change the Simulated Size: to Freeform and play with the height; but, not sure what that does, or if that's going to be inflexible for various screen sizes.


回答1:


Change the simulated size from fixed to freeform then change the values to whatever you'd like.



来源:https://stackoverflow.com/questions/51105728/segue-shrinks-viewcontroller-how-to-keep-normal-size

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