У меня есть UIImagePickerController добавил к моему мнению, таким образом:Фикс UIImagePickerController портретной ориентации
- (IBAction)TakeCameraShot:(id)sender{
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera])
{
// Given by default your orientation is in landscaperight already
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications])
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
/* picker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
picker.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;*/
[self presentViewController:picker animated:YES completion:nil];
/* picker.view.layer.cornerRadius = 150;
picker.view.clipsToBounds = YES;
picker.view.frame = CGRectMake(12, 60, 296, 290);*/
}else{
NSLog(@"Camera is not available");
UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Important message" message:@"Unfortunately the camera is not available on your device." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert1 show];
}
}
Я пытаюсь, чтобы предотвратить его от поворота на альбомную с этим кодом
// Given by default your orientation is in landscaperight already
while ([[UIDevice currentDevice] isGeneratingDeviceOrientationNotifications])
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
Ответ на этот вопрос переполнения стека также сказал, что он будет работать, только если UIviewController уже настроен только на портрет, так что это то, что я сделал из общих настроек приложения (где вы выбираете ipad, iphone или универсальный). Но это не работает.
Я сожалею сказать, но это на самом деле не работает ... – Alessandro
не вы используете накладку –
не только код, который вы видите на вопрос – Alessandro