iOS 图片显示格式:

UIViewContentModeScaleToFill 

UIViewContentModeScaleAspectFit 

UIViewContentModeScaleAspectFill 

UIViewContentModeRedraw 

UIViewContentModeCenter 

UIViewContentModeTop 

UIViewContentModeBottom 

UIViewContentModeLeft 

UIViewContentModeRight 

UIViewContentModeTopLeft 

UIViewContentModeTopRight 

UIViewContentModeBottomLeft 

UIViewContentModeBottomRight 

注意以上几个常量,凡是没有带Scale的,当图片尺寸超过 

ImageView尺寸时,只有部分显示在ImageView中。UIViewContentModeScaleToFill属性会导致图片变形。UIViewContentModeScaleAspectFit会保证图片比例不变,而且全部显示在ImageView中,这意味着ImageView会有部分空白。UIViewContentModeScaleAspectFill也会证图片比例不变,但是是填充整个ImageView的,可能只有部分图片显示出来。

 

相关文章:

  • 2021-09-17
  • 2021-10-17
  • 2020-12-25
  • 2021-09-30
  • 2021-10-09
  • 2021-09-21
  • 2021-11-13
猜你喜欢
  • 2021-11-20
  • 2021-05-19
  • 2021-06-23
  • 2021-11-06
  • 2021-11-03
  • 2021-09-08
  • 2018-09-05
  • 2022-01-14
相关资源
相似解决方案