2011년 12월 1일 목요일

iPhone's not consistent oritention policy

You can get orientation by 3 ways:
  1. UIInterfaceOrientation orientation = self.interfaceOrientation; returns UIInterfaceOrientation, current orientation of the interface. It is a property in UIViewController, you can access to this one only in UIViewController classes.
  2. UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; returns UIInterfaceOrientation, current orientation of the application's status bar. You can access to that property in any point of your application. My experience shows that it's more effective way to retrieve real interface orientation.
  3. UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];returns UIDeviceOrientation, device orientation. You can access to that property in any point of your application. But note that UIDeviceOrientation is not always UIInterfaceOrientation. For example, when your device is on a plain table you can receive unexpected value.

    출처: http://stackoverflow.com/questions/634745/iphone-orientation

댓글 없음:

댓글 쓰기