swift - The main view's height is changing between viewControllers. How should I keep them the same? -
i creating app uitabbarcontroller @ top level navigation controllers children. when transition first screen tab, frame of vc.view (0.0, 0.0, 375.0, 618.0) , when segue vc, vc.view's frame vc (0.0, 0.0, 375.0, 667.0). since difference 49, assuming because tabbar's height taken account first time around not apply further down stack. use proportional constraints based on these numbers. there option remove tabbar height or option not remove height. want setup every main vc's view height equal.
placing in viewdidload() of descendant vcs fixes problem:
let size = cgsize(width: uiscreen.main.bounds.width, height: uiscreen.main.bounds.height - tabbarcontroller!.tabbar.frame.height) view.frame = cgrect(origin: .zero, size: size)
but feels hacky me , prefer toggled option or setting.
if you're using storyboards or xibs, make sure constraint view's bottom pinned view
instead of bottom layout guide
. should work well.
Comments
Post a Comment