UIImage Aspect Fit when using drawInRect?

后端 未结 6 1194
囚心锁ツ
囚心锁ツ 2020-12-13 18:51

UIView provides for the \"aspect fit\" content mode. However, I\'ve subclasses UIView and would like to draw a UIImage using drawInRect with an aspect fit. Is there any way

6条回答
  •  孤城傲影
    2020-12-13 19:25

    The following will let you determine the size to draw in. You specify the aspect ratio and the bounding size to fit into.

    CGSizeAspectFit & CGSizeAspectFill

提交回复
热议问题