0
장치 방향이 변경 될 때 애니메이션을 실행해야하는 UIScrollView 하위 클래스를 만듭니다. 이를 위해서는 오리엔테이션 변화의 정확한 기간을 알아야합니다.하위 클래스의 오리엔테이션 변경 지속 시간을 감지합니까? iOS7
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
을 그리고 선택기 전화 :
-(void)orientationChanged:(id)selector
{
NSLog(@"Orientation has changed");
}
을이 이후
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
NSLog(@"%f", duration);
}
내가 대신 다음 코드를 사용할 필요가 서브 클래스에 있습니다 뷰 컨트롤러에서 나는 그냥이 사용한 것
유일한 문제는 장치 방향의 지속 시간을 알려주지 않는다는 것입니다. 누구든지 그것을 얻는 방법을 알고 있습니까?