2011-08-12 4 views
1

iPhone 응용 프로그램을 개발 중입니다. 오리엔테이션 진행 여부를 나타내는 UIViewController에 기본 상태/접근자가 있습니까? UIViewController : 방향 확인 중

은 현재 내가 수행 한 다음 UIViewController의 서브 클래스에서

BOOL 회원이 더 좋은 방법이 있나요 isOrientationChangeInProgress

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
isOrientationChangeInProgress = YES; 
} 

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
isOrientationChangeInProgress = NO; 
} 

라고?

+1

을 발생하면? – jtbandes

답변

0

Apple은 willRotateToInterfaceOrientation:duration:에서 모든 애니메이션을 시작하도록 권장하므로 해당 메서드가 호출 된 후 곧 회전합니다. duration 속성은 회전이 완료되면 didRotateFromInterfaceOrientation:이 호출되는 데 걸리는 시간을 알려주거나 나중에 약 초 후에 실행됩니다.

그래서, 당신의 BOOL이 뒷얘기에서해야 할 가장 좋은 것이라고 생각합니다. 나는 왜 당신이 이것을 알 필요가 있는지 이해하지 못한다; 어쩌면 당신이 원하는 결과를 다른 방법으로 얻을 수 있습니다. 너 뭐하려고?

0

당신은뿐만 아니라 장치 방향 정보를 이야기 할 수 요청할 수 있습니다 :

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) 
               name:UIDeviceOrientationDidChangeNotification object:nil]; 

그런 다음 orientationChanged에 말했다 얻을 :이 필요합니까 왜 변화가