1

: [self deviceInterfaceOrientationChanged:interfaceOrientation];경고 : 열거 형 'UIInterfaceOrientation'에서 다른 열거 형 'UIDeviceOrientation'으로의 암시 적 변환? 이 라인에서

나는 유 좀 도와 줄래이 경고

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

을 보내 주시기 바랍니다?. U를

여기 코드 것 감사합니다 :

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

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


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

다음 게시물을 참조하십시오. 그것은 완벽하게 대답합니다. [유래 포스트] [1] [1] : http://stackoverflow.com/questions/7015709/xcode-getting-warning-implicit-coversion-from-enumeration-type-uideviceorienta – georryan

답변

0

UIDeviceOrientation 및 UIInterfaceOrientation 다른 유형은, 첫 번째는 장치 방향이고 두 번째는 2D 상태를 커버하면서까지 얼굴 같은 다른 상태를 포함하거나 다른 사람의 사이에서 아래로 얼굴 , 초상화와 풍경처럼.

이 같은 장치에서하지만, 상태 표시 줄에서 장치의 방향을하지 마세요 :

[[UIApplication sharedApplication] statusBarOrientation] 

이 방법은 UIInterfaceOrientation 값을 반환하고 문제가 사라집니다.

+0

viewWillTransitionToSize에서는 작동하지 않습니다. – Dmitry

+0

viewWillTransitionToSize는 방향에 의존하지 않지만 방향 사용을 추상화하고 다른 종류의 이벤트도 포함 할 수있는 특정 이벤트가 발생하면 앱보기의 크기가 어떻게 변경 될지에 대한 것입니다. 어떤 종류의 오리엔테이션 코드를 사용해도 그 패러다임을 따르고 싶다면 잘못 될 수 있습니다. –