0

我在弹出窗口中显示相机(在 iPad 上 - iPad 应用程序被锁定到 Lanscape Left)并且预览是纵向的并且比例错误。代码如下 - 我已经计算出旋转并添加了它,但现在预览尺寸太薄了。

   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];
4

2 回答 2

1

原来是 iOS 6.0 处理旋转方式的问题——它在 6.1 中修复

于 2013-02-11T00:12:41.490 回答
0

我认为这是您问题的解决方案,因此您可以按照下面提供的链接遵循代码。

横向 UIImagePickerController

它将对您有很大帮助。享受编码。

于 2013-02-08T06:57:22.273 回答