【问题标题】:Align UIImageView with contentMode AspectFill AND Top将 UIImageView 与 contentMode AspectFill 和顶部对齐
【发布时间】:2015-11-04 09:25:23
【问题描述】:

当我使用 AspectFill 时,图像将在图像视图中居中,顶部和底部被切断。但我希望它从顶部开始,而不是中心。我看到很多问题,但都是关于AspectFit,而不是AspectFill。无论如何将 AspectFill 和 Top 都应用于 UIImageView 的 contentMode?​​p>

【问题讨论】:

    标签: ios uiimageview uiviewcontentmode


    【解决方案1】:

    我刚刚找到这个UIImageViewAligned 并决定回答我自己的问题。效果很好。

    它是 UIImageView 的子类,允许您自定义视图框架内显示图像的对齐方式。即使 contentMode 设置为 AspectFit、AspectFill 或 ScaleToFill,这也有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-04
      • 2014-09-25
      相关资源
      最近更新 更多