Returns a scaled rectangle that maintains the specified aspect ratio within a bounding rectangle.
- iOS 4.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
The width and height ratio (aspect ratio) you want to maintain.
The bounding rectangle you want to fit into.
Returns a scaled
CGRect that maintains the aspect ratio specified by
aspect that fits within
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. For example: