将contentMode设置为UIViewContentModeScaleAspectFit时,如何设置UIImageView左对齐或右对齐? [英] how to set the UIImageView align left or right when set the contentMode to UIViewContentModeScaleAspectFit?

查看:866
本文介绍了将contentMode设置为UIViewContentModeScaleAspectFit时,如何设置UIImageView左对齐或右对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 UIImageView 中使用 UIViewContentModeScaleAspectFit 时控制图像对齐。

I want to control the image alignment when using the UIViewContentModeScaleAspectFit in UIImageView.

例如,我在上面的一个视图中有两个 UIImageView 。这两个 UIImageView 的contentMode是 UIViewContentModeScaleAspectFit 。现在我想将图像3设置为右对齐,将图像4设置为左对齐,以便这两个图像可以在一起。

For example, I have two UIImageView in one view as above.these two UIImageView's contentMode is UIViewContentModeScaleAspectFit. Now I want to set image 3 to align right and image 4 to align left, so that these two images can be together.

我尝试将contentMode设置为 UIViewContentModeScaleAspect | UIViewContentModeLeft ,但这会让事情变得更糟。

I try to set the contentMode to UIViewContentModeScaleAspect|UIViewContentModeLeft, but it make things worse.

任何建议都表示赞赏。

推荐答案

最后,我发现 UIImageViewAligned 项目可以解决这个问题。

Finally, I find UIImageViewAligned project which can work it out.

这篇关于将contentMode设置为UIViewContentModeScaleAspectFit时,如何设置UIImageView左对齐或右对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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