【发布时间】:2015-07-03 03:20:49
【问题描述】:
我是 iOS 编程新手,现在我正在使用 AVFoundation 编写相机应用程序。我的问题是我必须以全屏尺寸预览刚刚拍摄的图像,但无论我如何尝试,我都只是在手机上获得了一个全屏显示的剪辑图像(原始图像的左上角比例)。我刚刚拍摄的图像是 1920 * 1080 分辨率,我的 UIImageView 设置为 AspectFit,在情节提要上,它以全屏显示。
显示图像的代码是这样的,
[self.imageView setFrame:self.view.bounds];
[self.imageView setContentMode:UIViewContentModeScaleAspectFit] ;
[self.imageView setImage:image] ;
[self.view insertSubview:_imageView aboveSubview:_previewView] ;
[self.view bringSubviewToFront:_stillButton] ;
[self.view bringSubviewToFront:_maskButton] ;
[self.view bringSubviewToFront:_confirmButton] ;
而当我观察UIImageView对象self.imageView的大小时,大小并不是屏幕大小,而是320*568。但是,作为 AVFoundation 相机拍摄预览对象的 previewView 也是 320*568,但是从正在运行的应用程序的外观来看,预览视图的大小是正确的。最后self.view.frame.size也是320*568。
所以我的问题是如何全屏查看 1920*1080 拍摄的图像?
【问题讨论】:
标签: ios objective-c image uiimageview