iPhone/iPad 旋转

标签 iphone objective-c ipad

如何检测这些设备上旋转的开始和结束?

编辑: 那么在您回答之后,我如何检测方向变化的开始和结束。

最佳答案

您可以在您的 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/

相关文章:

iphone - UIButton 禁用和启用背景图像

iphone - 如何使用 NSXMLParser 解析此 xml 数据

iphone - 应用程序在后台时在特定时间播放声音

iphone - 如何使用 AVAudioPlayer 在 iPhone sdk 中暂停和恢复同一首歌曲

Objective-C 到 Swift 3 方法名称更改问题

php - 使用AES用Objective-C加密用PHP解密

iphone - 平移手势弄乱了基于旋转的方向

iphone - 核心数据更新模型与应用程序更新?

ios - 如何使用 AppleScript 删除 plist 键

javascript - while 循环内的 if 语句。它为什么要这样做?