如何在没有疼痛的情况下调整UIImages的大小? [英] How do i resize UIImages without the pain?

查看:109
本文介绍了如何在没有疼痛的情况下调整UIImages的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过:


  • 各种UIImage调整大小代码错误且有错误的指控

  • 调整低质量图像的代码

  • 调整代码
    翻转图像

  • 调整代码不起作用正确地在
    肖像相机照片上正确

  • Accusations that various UIImage resizing code is wrong and has bugs
  • Resizing code which comes out with low quality images
  • Resizing code which flips the image
  • Resizing code which doesn't work correctly on portrait camera photos specifically

是否有一段代码用于调整/裁剪UIImage,有人可以推荐?

Is there a piece of code for resizing/cropping a UIImage that somebody could recommend?

推荐答案

我使用 https://stackoverflow.com/a/10491692/1271826 这是一个提供 UIImage 一系列调整大小方法的类别,它有效地支持 UIViewContentModeScaleToFill UIViewContentModeScaleAspectFill ,以及 UIViewContentModeScaleAspectFit

I use the category shown here in https://stackoverflow.com/a/10491692/1271826 which is a category that provides UIImage a series of resizing methods, which effectively supports UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFill, and UIViewContentModeScaleAspectFit.

我主要使用它来创建我的缩略图(使用我的 imageByScalingAspectFillSize ),并使用不同格式的图像没有事故。

I use this primarily for creating my thumbnail images (using my imageByScalingAspectFillSize) and do this with images of varying formats without incident.

这篇关于如何在没有疼痛的情况下调整UIImages的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆