如何在不同的方向保持相同的导航栏高度?

时间:2010-10-15 07:34:41

标签: iphone cocoa-touch

我通过注册作为观察者来处理方向,并将navigationController的视图旋转到所需的方向。但是一些视图控制器通过以下方法处理方向变化。

Responding to View Rotation Events

  • willRotateToInterfaceOrientation:持续时间:
  • willAnimateRotationToInterfaceOrientation:持续时间:
  • didRotateFromInterfaceOrientation:
  • willAnimateFirstHalfOfRotationToInterfaceOrientation:持续时间:
  • didAnimateFirstHalfOfRotationToInterfaceOrientation:
  • willAnimateSecondHalfOfRotationFromInterfaceOrientation:持续时间:

这些方法会使横向导航栏的高度变薄,我不希望出现这种情况。我希望导航栏的高度永远不会改变。怎么做到这一点?

1 个答案:

答案 0 :(得分:0)

我通过在根视图控制器上接收方向更改通知来解决此问题,然后在每次方向更改发生时重新指定导航栏的大小。它运行良好,但官方文档不鼓励设置框架,边界属性导航栏。