ALAssetRepresentation Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AssetsLibrary.framework |
| Availability | Available in iOS 4.0 and later. |
| Declared in | ALAssetRepresentation.h |
Overview
An ALAssetRepresentation object encapsulates one of the representations of a given ALAsset object.
A given asset in the library may have more than one representation. For example, if a camera provides RAW and JPEG versions of an image, the resulting asset will have two representations—one for the RAW file and one for the JPEG file.
Tasks
Getting Image Representations
Getting Image Attributes
Getting Raw Data
Getting Metadata
Getting an URL
Instance Methods
CGImageWithOptions:
Returns a full resolution CGImage of the representation.
Parameters
- options
A dictionary of options as described for
CGImageSourceCreateWithDataorCGImageSourceCreateWithURL.
Return Value
A full resolution CGImage of the representation.
Discussion
This method provides a convenient way to obtain a CGImage representation of an asset. This method returns the biggest, best representation available, unadjusted in any way.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hdimensions
Returns the representation’s dimensions.
Return Value
The representation’s dimensions.
Discussion
If the representation doesn’t have valid dimensions, this method will return CGSizeZero.
Availability
- Available in iOS 5.1 and later.
Declared In
ALAssetRepresentation.hfilename
Returns a string representing the filename of the representation on disk.
Return Value
A string representing the filename of the representation on disk.
Discussion
For representations synced from iTunes, this will be the filename of the represenation on the host.
Availability
- Available in iOS 5.0 and later.
Declared In
ALAssetRepresentation.hfullResolutionImage
Returns a CGImage representation of the asset.
Return Value
A CGImage representation of the asset, or NULL if a CGImage representation could not be generated.
Discussion
This method returns the biggest, best representation available, unadjusted in any way.
To create a correctly-rotated UIImage object from the CGImage, you use imageWithCGImage:scale:orientation: or initWithCGImage:scale:orientation:, passing the values of orientation and scale.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hfullScreenImage
Returns a CGImage of the representation that is appropriate for displaying full screen.
Return Value
A CGImage of the representation that is appropriate for displaying full screen, or NULL if a CGImage representation could not be generated.
Discussion
The dimensions of the image are dependent on the device your application is running on; the dimensions may not, however, exactly match the dimensions of the screen.
In iOS 5 and later, this method returns a fully cropped, rotated, and adjusted image—exactly as a user would see in Photos or in the image picker.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hgetBytes:fromOffset:length:error:
Copies a specified range of bytes into a given buffer.
Parameters
- buffer
A buffer into which to copy the data.
You typically use
sizeto allocate a buffer of the right size.- offset
The number of bytes from the beginning of the file to start copying.
- length
The number of bytes to copy.
- error
If an error occurs, upon return contains an
NSErrorobject that describes the problem.Pass
NULLif you do not want error information.
Return Value
The number of bytes actually written to buffer. The number of bytes read will be less than the requested range if the range exceeds the file's size. If an error occurs, returns 0.
Discussion
This method returns the biggest, best representation available, unadjusted in any way.
Availability
- Available in iOS 4.0 and later.
See Also
Declared In
ALAssetRepresentation.hmetadata
Returns a dictionary of dictionaries of metadata for the representation.
Return Value
A dictionary of dictionaries of metadata for the representation. Returns nil if the representation is one that the system cannot interpret.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.horientation
Returns the representation’s orientation.
Return Value
The representation’s orientation. For a list of possible values, see ALAssetOrientation.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hscale
Returns the representation’s scale.
Return Value
The representation’s scale.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hsize
Returns the size in bytes of the file for the representation.
Return Value
The size in bytes of the file for the representation.
Discussion
You typically use this method to allocate a buffer of the right size for getBytes:fromOffset:length:error:.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hurl
Returns a persistent URL uniquely identifying the representation.
Return Value
A persistent URL uniquely identifying the representation.
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.hUTI
Returns the representation's UTI.
Return Value
The representation's UTI
Availability
- Available in iOS 4.0 and later.
Declared In
ALAssetRepresentation.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-12-13)