Я проверяю ориентацию устройства в viewDidAppear
и viewWillAppear
и принудительно ориентируюсь по телефону willAnimateRotationToInterfaceOrientation
.Проблема с ориентацией в iPad ios6
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
_levelComplete = YES;
[self willAnimateRotationToInterfaceOrientation:[[UIDevice currentDevice] orientation] duration:0.01];
}
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == (UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight))
{
}
else if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
}
}
Проблема я сталкиваюсь в том, что toInterfaceOrientation
это остается 0 для обоего viewDidAppear
и viewWillAppear
метода, следовательно, аварийного завершения работы программы.
В чем может быть проблема?
Пожалуйста, помогите!
Работает отлично! Спасибо :) Проблема с ориентацией [[UIDevice currentDevice]] –