Get current orientation of iPad? -


in given event handler (not "shouldautorotatetointerfaceorientation" method) how detect current ipad orientation? have text field have animate (when keyboard appears) in landscape view, not in portrait view , want know orientation i'm in see if animation necessary.

orientation information isn't consistent, , there several approaches. if in view controller, can use interfaceorientation property. other places can call:

[[uidevice currentdevice] orientation] 

alternatively, can request receive orientation change notifications:

[[uidevice currentdevice] begingeneratingdeviceorientationnotifications]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(orientationchanged:) name:uideviceorientationdidchangenotification object:nil]; 

some people check status bar orientation:

[uiapplication sharedapplication].statusbarorientation 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -