आप UIDeviceOrientation
और UIInterfaceOrientation
भ्रमित नहीं होना चाहिए, वे के रूप में उनके घोषणा
typedef enum {
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait,
UIDeviceOrientationPortraitUpsideDown,
UIDeviceOrientationLandscapeLeft,
UIDeviceOrientationLandscapeRight,
UIDeviceOrientationFaceUp,
UIDeviceOrientationFaceDown
} UIDeviceOrientation;
typedef enum {
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
UIDeviceOrientation
द्वारा दिखाए गए अलग लेकिन संबंधित हैं बताता है कि उपकरण के ओरिएंटेशन है। UIInterfaceOrientation
आपको बताता है कि आपके इंटरफ़ेस का अभिविन्यास क्या है, और UIViewController
द्वारा उपयोग किया जाता है। UIInterfaceOrientation
स्पष्ट रूप से या तो चित्र या परिदृश्य होगा, जबकि UIDeviceOrientation
अस्पष्ट मूल्य (UIDeviceOrientationFaceUp
, UIDeviceOrientationFaceDown
, UIDeviceOrientationUnknown
) हो सकता है।
किसी भी मामले में आप किसी भी डिवाइस उन्मुखीकरण है UIViewController interfaceOrientation
संपत्ति अलग हो सकता है के रूप में, [[UIDevice currentDevice] orientation]
के साथ एक UIViewController के उन्मुखीकरण का निर्धारण करने के प्रयास नहीं करना चाहिए (उदाहरण के लिए आपके एप्लिकेशन को सभी [[UIDevice currentDevice] orientation]
पर परिदृश्य के लिए बारी बारी से नहीं करता है तो यह कर सकते हैं UIDeviceOrientationLandscapeLeft
हो जबकि viewController.interfaceOrientation
UIInterfaceOrientationPortrait
हो सकता है)।
अद्यतन: आईओएस 8.0, [UIViewController interfaceOrientation]
के रूप में बहिष्कृत किया गया है। एक विकल्प पेश किया गया here[[UIApplication sharedApplication] statusBarOrientation]
है। यह UIInterfaceOrientation
भी देता है।