【发布时间】:2017-06-07 11:00:28
【问题描述】:
我正在使用 UIImagePickerController 为我的应用选择图像。但是我遇到了所选图像的纵横比问题。图像显示大于其原始尺寸并且未显示完整图像。我尝试将UIViewContentMode 属性更改为所有可能的值仍然没有用。任何人都可以指导我如何使它工作?
这里是 UIImagePickerController 委托的实现
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo {
self.imageProfile.contentMode = UIViewContentModeScaleAspectFit;
self.imageProfile.image = image;
[picker dismissViewControllerAnimated:YES completion:nil];
}
【问题讨论】:
-
尝试使用 contentmodescaleaspectfill
-
向我们展示你对
UIImagePickerControllerDelegate的实现 -
根据您的图像宽度和宽高比调整您的图像高度,检查这个答案也许可以帮助您找出stackoverflow.com/questions/44338392/…
-
@ReinierMelian 是的,我尝试将图像高度和宽度赋予图像视图..即使它没有显示完整图像。
-
@ZeenathYousuff 好的,我会尽力帮助你的,你正在使用自动布局吗?你也可以发布当前图像方面和想要的?
标签: ios objective-c uiimagepickercontroller aspect-ratio