【问题标题】:ipad UIImagePickerController different size on preview and on take pic Landscapeipad UIImagePickerController 在预览和拍照时大小不同
【发布时间】:2013-07-05 06:45:02
【问题描述】:

我一直在阅读不同的答案,但无法解决这个问题:

在我的 iPad 应用程序中,横向模式下,我有一个 UIImagePickerController 来拍照,这个选择器显示在 UIPopoverController 中。

问题是预览和拍照后的图片大小不一样

预览:

.

拍照后:

这里是我设置选择器和 popOver 的代码:

BOOL hasCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];

    picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;

    picker.sourceType = hasCamera ? UIImagePickerControllerSourceTypeCamera :    UIImagePickerControllerSourceTypePhotoLibrary;

    picker.modalPresentationStyle = UIModalPresentationFullScreen;

    picker.cameraDevice = UIImagePickerControllerCameraDeviceFront; 
    [picker setShowsCameraControls:FALSE];

    self.companyPopOverController = [[[UIPopoverController alloc] initWithContentViewController:picker] autorelease];

    self.companyPopOverController.passthroughViews=[NSArray arrayWithObject:self.view];
[self.companyPopOverController presentPopoverFromRect:CGRectMake(622, 534, 10, 10) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

并显示拍摄的照片:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    UIImage *image=[info objectForKey:UIImagePickerControllerOriginalImage];
    [self.picImage setImage:image];
    [self.companyPopOverController dismissPopoverAnimated:YES];
    self.imageTaken = YES;
}

那么我怎样才能使我的预览图像与实际拍摄的图像大小相同?

谢谢!

【问题讨论】:

    标签: ios uiimagepickercontroller uipopover


    【解决方案1】:

    我在您的示例图片中看到 2 个不同之处:尺寸和水平翻转。

    大小差异可能是因为您设置了picker.modalPresentationStyle = UIModalPresentationFullScreen;,但随后您将其显示在较小的弹出窗口中。 我会尝试在没有弹出框的情况下展示选择器,看看它是否有效。

    此外,预览图像看起来有点失真。如果您使用 Scale To Fill 作为 imageView 的 contentMode,那么我会将其更改为 Aspect Fill。

    我不知道水平翻转可能来自哪里。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-22
      • 2012-06-03
      • 1970-01-01
      相关资源
      最近更新 更多