Пожалуйста, помогите мне. У меня есть методы:
-(void) getCurrentOrientation{
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if(orientation == UIInterfaceOrientationPortrait){
NSLog(@"portrait");
} else if(orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"LandscapeRight");
} else if(orientation == UIInterfaceOrientationLandscapeLeft) {
NSLog(@"LandscapeLeft");
}
}
но когда я вызываю это getCurrentOrientation, бросаем viewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
[self getCurrentOrientation];
}
NSLog пуст. В чем дело ?
Я тоже попробую
- (void)viewDidLoad
{
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if ( ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait)) {
NSLog(@"portrait");
} else if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)
{
NSLog(@"LandscapeRight");
}
}
но этот вариант тоже пустой.
Мне нужно знать, в каком ОРИЕНТАЦИИ пользователь запускает приложение!
Пожалуйста, дайте мне любой совет.