The nav bar doesn't resize properly in landscape mode

隐身守侯 提交于 2019-12-11 16:38:18

问题


In IB I created a xib with a navigation bar and a grouped tableview.

In landscape mode, the nav bar doesn't resize properly. I tried to change the autosizing mask. I changed it from IB. For the nav bar, I have set flexible width (red arrow) and the edge distances from superview ones are all set except the bottom margin (no red line, that is flexible bottom margin). For the tableview all lines are red except the top margin (so flexible top margin)... the nav bar resizes, but the two buttons on it don't resize. I tried other combinations, but nothing. This doesn't work for me.

The same thing happens with another xib with a navigation bar, a grouped tableview and an image between them.

Both the views corresponding to these xib are modal.

How could the problem be? I'd prefer to not set them manually. I tried to do it with the modal view with navbar, image and tableview and I don't succeed in doing work it.

Thanks.


回答1:


In IB I removed the navbar and in the code I used:

MyViewController *controller = [[MyViewController alloc]                                 
                              initWithNibName:@"MyViewController" bundle:nil]; 
UINavigationController *innerNav = [[UINavigationController alloc] 
                              initWithRootViewController:controller]; 
[self presentModalViewController:innerNav animated:YES]; 
[controller release]; 
[innerNav release]; 

in this way I've not problems in landscape mode.



来源:https://stackoverflow.com/questions/5091584/the-nav-bar-doesnt-resize-properly-in-landscape-mode

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