在iOS9,iPad设备中,使用imagePickerController获取本地图片并编辑后,图片的大小只显示左上角的部分,无法显示裁剪框内的内容。
代码
//获取本地图片
if (!_imagePickerController) {
_imagePickerController = [[UIImagePickerController alloc] init];
}
_imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
_imagePickerController.allowsEditing = YES;
_imagePickerController.delegate = self;
[self presentViewController:_imagePickerController animated:YES completion:nil];
break;
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
weakifyself;
[picker dismissViewControllerAnimated:YES completion:^{
strongifyself;
UIImage *image;
image = info[UIImagePickerControllerEditedImage] ?: info[UIImagePickerControllerOriginalImage];
cell.iconImage.image = image;
}
}];
}
显示效果如图:
选择相册图片edit相应内容
显示效果,只有左上角的内容