Я искал ответ на это, но ничего не могу придумать. По-видимому, iPhone SDK 3.0 позволил, что UIImagePickerController может быть отображен в альбомном режиме - но я не нахожу метода, который позволит это. Я думал бы, что, если бы приложение находится в среде по умолчанию, это автоматически скорректировало бы контроллер изображения, но это не работает на меня.
Спасибо за любую справку!
Я не проверил, является ли это незаконным, но это сработало для меня. Если вы хотите начать (и остаться) в коде ландшафтного ориентации:
//Initialize picker
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
//set Device to Landscape. This will give you a warning. I ignored it.
//warning: 'UIDevice' may not respond to '-setOrientation:'
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
//Set Notifications so that when user rotates phone, the orientation is reset to landscape.
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
//Refer to the method didRotate:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:@"UIDeviceOrientationDidChangeNotification" object:nil];
//Set the picker source as the camera
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
//Bring in the picker view
[self presentModalViewController:picker animated:YES];
Метод Derotate:
- (void) didRotate:(NSNotification *)notification
{
//Maintain the camera in Landscape orientation
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
}
Я решал эту проблему следующим образом: после каждого изменения ориентации я просто повторно создаю сборник. Попробуй это. По-разному слишком криво ...