iPad camera popover preview wrong rotation and scale

不想你离开。 提交于 2019-12-13 06:29:24

问题


I am showing the camera in a popover (on an iPad - the iPad app is locked to Lanscape Left) and the preview is in Portrait and the wrong scale. The code is below - I have worked out the rotation and added it, but the preview size is the too thin now.

   UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

   if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
   {
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.videoQuality = UIImagePickerControllerQualityTypeMedium;
    imagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];

    CGAffineTransform transformRotation = CGAffineTransformMakeRotation(270 * M_PI/180);

    imagePicker.cameraViewTransform = transformRotation;
    }
    else
    {
       NSLog(@"Camera not available. Using photo library");
       imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    }

     imagePicker.delegate = self;
     _photoPopover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
     [_photoPopover presentPopoverFromRect:view.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

回答1:


Turns out to be an issue with the way iOS 6.0 deals with rotation - its fixed in 6.1




回答2:


I think this is the solution for ur question so u can follow the code as per this link provided below.

UIImagePickerController in Landscape

It will helps u a lot.Enjoy the coding.



来源:https://stackoverflow.com/questions/14766523/ipad-camera-popover-preview-wrong-rotation-and-scale

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!