views:

26

answers:

2

i need to draw PortraitImage or LandscapeImage when my costomNavigation has been change to portrait or landscape.

A: 

You need to override willRotateToInterfaceOrientation:duration: in your UIViewController. This will give you a call every time the app changes its orientation.

kasperjj
did you mean UIViewController must send message to norify my customNavigationbar ?
RAGOpoR
well, if you override that method in your UIViewController you will get a notice when the orientation changes and you can then do with that what you want depending on your apps architecture... but sending a message to your customNavigationbar would probably make sense :-)
kasperjj
A: 

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.

Nick H