Как получить текущую ориентацию устройства в расширении приложения, я попытался использовать два метода, но не имел успеха.
-  Он всегда возвращает UIDeviceOrientationUnknown [[UIDevice currentDevice] orientation]
-  В нем отображается красное сообщение о том, что 'sharedApplication недоступно в iOS (расширение приложения) [[UIApplication sharedApplication] statusBarOrientation];
-  Я также добавляю наблюдателя, но не получаю вызов. [[NSNotificationCenter defaultCenter] addObserver:self.view selector:@selector(notification_OrientationWillChange:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; - (void)notification_OrientationWillChange:(NSNotification*)n { UIInterfaceOrientation orientation = (UIInterfaceOrientation)[[n.userInfo objectForKey:UIApplicationStatusBarOrientationUserInfoKey] intValue]; if (orientation == UIInterfaceOrientationLandscapeLeft) [self.textDocumentProxy insertText:@"Left"]; if (orientation == UIInterfaceOrientationLandscapeRight) [self.textDocumentProxy insertText:@"Right"]; }
Итак, как можно получить текущую ориентацию устройства.
