如何检测这些设备上旋转的开始和结束?
编辑: 那么在您回答之后,我如何检测方向变化的开始和结束。
最佳答案
您可以在您的 UIViewController 中实现以下两个方法。
要检测旋转的开始,请执行 willRotateToInterfaceOrientation:duration:并检测末端实现 didRotateFromInterfaceOrientation: .
即
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
NSLog(@"I am starting to rotate");
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
NSLog(@"I have finished rotating");
}
关于iPhone/iPad 旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2920465/