Difference between UIViewContentModeScaleAspectFit and UIViewContentModeScaleToFill?

▼魔方 西西 提交于 2019-11-26 03:27:18

问题


what is the difference between UIViewContentModeScaleAspectFit and UIViewContentModeScaleToFill...?


回答1:


If you are talking about UIViewContentMode, the following is from the Doc.

UIViewContentModeScaleToFill

Scales the content to fit the size of itself by changing the aspect ratio of the content if necessary.

UIViewContentModeScaleAspectFit

Scales the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.

UIViewContentModeScaleAspectFill

Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.




回答2:


You can see the differences between the content modes here:

Redraw mode works as Scale to Fill mode. But there is a difference in how they are drawn when view geometry changes. Scale to Fill mode uses already rendered content while Redraw mode renders the content again.




回答3:


uiimageview-scaling-explained-visually



来源:https://stackoverflow.com/questions/4895272/difference-between-uiviewcontentmodescaleaspectfit-and-uiviewcontentmodescaletof

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!