问题描述
||
我正在尝试在表格视图单元格中显示一组图像。所有图像大小均不同。我想裁剪或调整图像大小,以便在照片应用程序中看起来像。我该如何实现。
谢谢,
沙吉
cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];
cell.imageView.image = image;
UIImageView * view=cell.imageView;
view.frame = CGRectMake(0,70,70);//not working
view.bounds = CGRectMake(0,70);//not working
我的结果;
期待
照片应用程序很好地将每个图像更改为统一大小。
解决方法
在下面使用裁剪图像,您需要通过裁剪。
CGImageRef myImageRef = CGImageCreateWithImageInRect([largeImage CGImage],myCropRect);
myImage = [UIImage imageWithCGImage:myImageRef ]];
CGImageRelease(myImageRef );
, 使用NYXImagesUtilities中的UIImage+Resizing
类别。例:
UIImage* cropped = [myImage cropToSize:(CGSize){75,75} usingMode:NYXCropModeCenter];
还是自己做。