AVMakeRectWithAspectRatioInsideRect
Use this function when attempting to fit the presentation size of a player item object’s content within the bounds of another CALayer. Use the returned CGRect as the player layer’s frame property value
此外, 如果要在使用aspectFillMode模式的UIImageView中显示UIImage的精确大小的话(让图片适应一个矩形,不改变原始长宽比
), 使用这个函数也是很有用的。它可以根据你提供的size,然后自动计算当前size按比例能缩放成多大的,然后返回.返回的Rect是一个居中显示的矩形
注意,此函数返回的CGRect的中心与函数中传递的boundingRect的中心相同
函数的声明:
CGRect AVMakeRectWithAspec