iPad camera popover preview wrong rotation and scale
Asked Answered
F

2

0

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];
Fink answered 8/2, 2013 at 5:52 Comment(2)
Once check the frame u r setting for the popover .I am not getting the problem actually what ur facing.Webfooted
@sravankumar The problem is the preview of the camera feed is not correct - its the wrong rotation and scale.Fink
F
1

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

Fink answered 11/2, 2013 at 0:12 Comment(0)
W
0

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.

Webfooted answered 8/2, 2013 at 6:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.