У меня есть приложение с панелью вкладок и контроллерами навигации на каждой вкладке. Когда пользователь встряхивает устройство, в навигационном контроллере отображается дочерний вид UIImageView
. Но UIImageView
должен содержать специальное изображение, в зависимости от текущей ориентации устройства.
Если я пишу только
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
//Code
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight||interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
//Code
}
}
Взгляд просто сумасшедший, если пользователь повернул устройство перед тем, как встряхнуть.
Есть ли способ получить текущую ориентацию iPhone?