2011-08-10 21 views
21

पूर्ण चेतावनी "गणना प्रकार UIDeviceOrientation से अंतर्निहित रूपांतरण":Xcode: हो रही चेतावनी

Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation' 

लाइन पर यह हो रही है:

- (void)orientationChanged:(UIInterfaceOrientation)interfaceOrientation 

:

[self orientationChanged:interfaceOrientation]; 

इस विधि है मैं वास्तव में समझ नहीं सकता कि यह चेतावनी कहां से आ रही है।

उत्तर

89

UIDeviceOrientation डिवाइस के भौतिक अभिविन्यास को संदर्भित करता है जबकि UIInterfaceOrientation उपयोगकर्ता इंटरफ़ेस के अभिविन्यास को संदर्भित करता है। जब आप अपने विधि

[self orientationChanged:interfaceOrientation]; 

आप सबसे अधिक संभावना यह एक UIDeviceOrientation गुजर रहे हैं जब आप, विधि के अनुसार, एक UIInterfaceOrientation का उपयोग करना चाहिए कहते हैं।

बस इस मुद्दे पर थोड़ा विस्तार करने के लिए, UIDeviceOrientation वर्ग की संपत्ति है, और इन संभावित मान देखते हैं:

UIDeviceOrientationUnknown - निर्धारित नहीं किया जा सकता है

UIDeviceOrientationPortrait - होम बटन नीचे की ओर

UIDeviceOrientationPortraitUpsideDown - होम

UIDeviceOrientationLandscapeLeft को ऊपर की ओर बटन - होम बटन का सामना करना पड़ सही

UIDeviceOrientationLandscapeRight - होम बटन सामना

UIDeviceOrientationFaceUp छोड़ दिया - डिवाइस

UIDeviceOrientationFaceDown को ऊपर की ओर सपाट है, स्क्रीन के साथ - डिवाइस सपाट है, स्क्रीन

के रूप में नीचे का सामना करना पड़ के साथ UIInterfaceOrientation के लिए, यह UIApplication की एक संपत्ति है और इसमें केवल 4 संभावनाएं हैं जो स्टेटस बार के अभिविन्यास से मेल खाते हैं:

UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, 

UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, 

UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, 

UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft 

UIDeviceOrientation पाने के लिए, आप का उपयोग

[[UIDevice currentDevice] orientation] 

और UIInterfaceOrientation प्राप्त करने के लिए, आप का उपयोग

[[UIApplication sharedApplication] statusBarOrientation] 
+0

इस के लिए धन्यवाद कहने के लिए भूल। तो ... धन्यवाद –

+2

बस इस समस्या में फिर से भाग गया और आपने मुझे फिर से बचाया। काश मैं तुम्हें दो बार ऊपर उठा सकता हूं। –

संबंधित मुद्दे