Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
155 views
in Technique[技术] by (71.8m points)

iPhone Image Loading in Photos Application

I am not sure if this is the right forum for asking this question, but I googled "questions related to iPhone" and the first page had SO from top to bottom. So here goes.

When I open the Photos Application in iPhone (3GS, 4 and 5 all running iOS 5.0) and open an image, first a blurred image appears for a fraction of a second, which clears up into the actual picture. My question is, does the Photo application have a low resolution copy of the high res images which it displays while the image is being loaded, OR does it generate a low res image on the fly before going on to load the high res image.

I am writing an application to browse through the photos, and need to know which is the best approach. That is the purpose behind this question.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The best way is using ALAsset thumbnail . If you have concerns with image clarity, then go with ALAsset fullResolutionImage

Here are some details that you must read before going to start developing an photos application.

An instance of ALAssetsLibrary provides access to the videos and photos that are under the control of the Photos application.

An ALAsset object represents a photo or a video managed by the Photo application.

There are different ALAsset Accessing Representations

1.thumbnail

Returns a thumbnail representation of the asset.

- (CGImageRef)thumbnail

2.aspectRatioThumbnail

Returns an aspect ratio thumbnail of the asset.

- (CGImageRef)aspectRatioThumbnail

3.defaultRepresentation

Returns an asset representation object for the default representation.

- (ALAssetRepresentation *)defaultRepresentation

4.representationForUTI:

Returns an an asset representation object for a given representation UTI.

- (ALAssetRepresentation *)representationForUTI:(NSString *)representationUTI

An ALAssetRepresentation object encapsulates one of the representations of a given ALAsset object.

1.CGImageWithOptions:

Returns a full resolution CGImage of the representation.

- (CGImageRef)CGImageWithOptions:(NSDictionary *)options

2.fullResolutionImage

Returns a CGImage representation of the asset.

- (CGImageRef)fullResolutionImage

3.fullScreenImage

Returns a CGImage of the representation that is appropriate for displaying full screen.

- (CGImageRef)fullScreenImage

Sample Code


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...