How to detect orientation in costomNavigationbar?
i need to draw PortraitImage or LandscapeImage when my costomNavigati开发者_StackOverflowon has been change to portrait or landscape.
You need to override willRotateToInterfaceOrientation:duration: in your UIViewController. This will give you a call every time the app changes its orientation.
You can detect orientation by using the UIDevice Class, as shown here:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/orientation
You need to use the methods
- (void)beginGeneratingDeviceOrientationNotifications
and
- (void)endGeneratingDeviceOrientationNotifications
That should probably work.
精彩评论