четверг, 17 октября 2013 г.

iOS How to define interface orientation


Бывает необходимо определить текущее положение экрана - горизонтальное или вертикальное.

UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
 
if (interfaceOrientation == UIInterfaceOrientationMaskPortrait || 
    interfaceOrientation == UIInterfaceOrientationMaskPortraitUpsideDown) {
 
      NSLog(@"%@", @"portrait orientation"); // вертикальное
 
} else {
 
      NSLog(@"%@", @"landscape orientation");  // горизонтальное
 
}

Комментариев нет:

Отправить комментарий