导航栏在横向模式下无法正确调整大小 [英] The nav bar doesn't resize properly in landscape mode

查看:117
本文介绍了导航栏在横向模式下无法正确调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IB中,我创建了一个带有导航栏和分组表格视图的xib.

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

在横向模式下,导航栏的大小无法正确调整. 我尝试更改自动调整大小的蒙版.我从IB更改了它.对于导航栏,我已设置了灵活的宽度(红色箭头),并且除了下边距(没有红线,这是灵活的下边距)以外,所有到超级视图的边距都已设置.对于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.

另一个带有导航栏的xib也会发生同样的事情,一个分组的tableview和它们之间的图像.

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

与这些xib对应的视图都是 modal .

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.

谢谢.

推荐答案

在IB中,我删除了导航栏,并在我使用的代码中:

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.

这篇关于导航栏在横向模式下无法正确调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆