UIDeviceOrientationDidChangeNotification
을 준수하십시오
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
...
- (void)orientationDidChange:(NSNotification *)note
{
NSLog(@"new orientation = %d", [[UIDevice currentDevice] orientation]);
}
UIDevice Class Reference
난 당신이 이러한 알림이 전송하고자 할 때 요 유니드가 -beginGeneratingDeviceOrientationNotifications
을 추가 할 수 있습니다, 당신이 그들을 중지 할 때 -endGeneratingDeviceOrientationNotifications
를 호출해야합니다. 배터리를 생성 할 때 배터리에 영향을 미치므로보기가 화면에 나타나면 그렇게해야합니다. UIViewController
이 모든 작업을 수행하므로보기 컨트롤러가있는 경우 작업을 수행 할 가치가 있습니다.
layoutSubviews 호출의 변경 사항을 애니메이션화 할 수있는 완벽한 솔루션입니다. –