1      UIViewContentModeScaleToFill,         // 按设置尺寸 - 填充
 2          UIViewContentModeScaleAspectFit,      // 按设置尺寸 - 等比例填充, 有边界
 3          UIViewContentModeScaleAspectFill,     // 按原来尺寸 - 填充, clipsToBounds切除边界
 4          UIViewContentModeRedraw,              // redraw on bounds change (calls -setNeedsDisplay)
 5          UIViewContentModeCenter,              // contents remain same size. positioned adjusted.
 6          UIViewContentModeTop,
 7          UIViewContentModeBottom,
 8          UIViewContentModeLeft,
 9          UIViewContentModeRight,
10          UIViewContentModeTopLeft,
11          UIViewContentModeTopRight,
12          UIViewContentModeBottomLeft,
13          UIViewContentModeBottomRight,
14          
15          1. 凡是带有scale单词的, 图片会被拉伸
16          2. 凡是带有Aspect单词的, 图片会保持原来宽高比

 

1. UIViewContentModeScaleToFill,         // 按设置尺寸 - 填充 -- 比例失调(填充整个imageView) 

UIImageView 的 contentMode 

 

2. UIViewContentModeScaleAspectFill,     // 按图片宽高比 - 填充整个imageView,  clipsToBounds切除边界

  UIImageView 的 contentMode

3. UIViewContentModeScaleAspectFit    // 按图片尺寸  -- 适配imageView, 会有边界(会显露背景)

UIImageView 的 contentMode

4. UIViewContentModeRedraw,              // 调用了setNeedDisplay方法时, 将会对图片重新渲染

5. UIViewContentModeCenter,              // 以下不带scale的, 会将图片 直接按照设置放置.

         UIViewContentModeTop,

         UIViewContentModeBottom,

         UIViewContentModeLeft,

         UIViewContentModeRight,

         UIViewContentModeTopLeft,

         UIViewContentModeTopRight,

         UIViewContentModeBottomLeft,

         UIViewContentModeBottomRight,

UIImageView 的 contentMode 

相关文章:

  • 2022-01-09
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
猜你喜欢
  • 2022-03-07
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案