AV Foundation Functions Reference
| Framework | AVFoundation/AVFoundation.h |
| Declared in | AVUtilities.h |
Overview
This chapter describes the function defined in the AVFoundation Framework.
Functions
AVMakeRectWithAspectRatioInsideRect
Returns a scaled CGRect that maintains the aspect ratio specified by a CGSize within a bounding CGRect.
CGRect AVMakeRectWithAspectRatioInsideRect(CGSize aspectRatio, CGRect boundingRect);
Parameters
- aspectRatio
The width and height ratio (aspect ratio) you want to maintain.
- boundingRect
The bounding rectangle you want to fit into.
Return Value
Returns a scaled CGRect that maintains the aspect ratio specified by aspectRatio that fits withinboundingRect.
Discussion
This is useful when attempting to fit the naturalSize property of an AVPlayerItem object within the bounds of another CALayer. You would typically use the return value of this function as an AVPlayerLayer frame property value. For example:
myPlayerLayer.frame = AVMakeRectWithAspectRatioInsideRect(myPlayerItem.naturalSize, mySuperLayer.bounds); |
Availability
- Available in iOS 4.0 and later.
Declared In
AVUtilities.h© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-05-15)