开发者

How to detect orientation in costomNavigationbar?

开发者 https://www.devze.com 2023-01-04 02:56 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消