1

[self deviceInterfaceOrientationChanged:interfaceOrientation];警告:列挙型 'UIInterfaceOrientation'から異なる列挙型 'UIDeviceOrientation'への暗黙的な変換ですか?この行で

私はuが私を助けることができるこの警告

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

を入手してください?。 、UIDeviceOrientationとUIInterfaceOrientationは異なるタイプである

 
    -(void) receivedRotate: (NSNotification*) notification 
{ 
    NSLog(@"receivedRotate"); 
    UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation]; 

    if(interfaceOrientation != UIDeviceOrientationUnknown) { 
     [self deviceInterfaceOrientationChanged:interfaceOrientation]; 


    } else { 
     NSLog(@"Unknown device orientation"); 
    } 
} 
+0

次の記事を参照してください。それは完全にそれに答える。 [StackOverflowのポスト] [1] [1]:http://stackoverflow.com/questions/7015709/xcode-getting-warning-implicit-coversion-from-enumeration-type-uideviceorienta – georryan

答えて

0

最初はデバイスの向きであり、第二のみ2D状態を覆いながら、とりわけ上向きまたは下向きのような他の状態を含む:ここ

コードだUに感謝、ポートレートと風景のように。

デバイスからではなく、このようなステータスバーからデバイスの向きを取得しないでください:

[[UIApplication sharedApplication] statusBarOrientation] 

この方法はUIInterfaceOrientation値を返し、問題が消えます。

+0

viewWillTransitionToSizeでは機能しません。 – Dmitry

+0

viewWillTransitionToSizeは方向に依存しませんが、向きの使用を抽象化し、他の種類のイベントも含めることができる特定のイベントの後に、あなたのアプリケーションビューのサイズがどのように変更されるかについてです。任意の種類のオリエンテーションコードを使用すると、そのパラダイムに従いたい場合は間違いがあります。 –

関連する問題