Iphone 如何在costomNavigationbar中检测方向?

Iphone 如何在costomNavigationbar中检测方向?,iphone,uinavigationbar,Iphone,Uinavigationbar,当我的costomNavigation更改为纵向或横向时,我需要绘制纵向图像或景观图像。您需要覆盖UIViewController中的willRotateToInterfaceOrientation:duration:。每次应用程序更改方向时,都会给您打电话。您可以使用UIDevice类检测方向,如下所示: 你需要使用这些方法 - (void)beginGeneratingDeviceOrientationNotifications 及 这可能会起作用。你的意思是UIViewContro

当我的costomNavigation更改为纵向或横向时,我需要绘制纵向图像或景观图像。

您需要覆盖UIViewController中的willRotateToInterfaceOrientation:duration:。每次应用程序更改方向时,都会给您打电话。

您可以使用UIDevice类检测方向,如下所示:

你需要使用这些方法

- (void)beginGeneratingDeviceOrientationNotifications  


这可能会起作用。

你的意思是UIViewController必须发送消息来norify my customNavigationbar吗?好吧,如果你在UIViewController中覆盖该方法,当方向发生变化时,你会收到通知,然后你可以根据你的应用程序体系结构来处理该方法。。。但向customNavigationbar发送消息可能有意义:-)
- (void)endGeneratingDeviceOrientationNotifications