Getting thumbnails from photos library
I want to save the thumbnails from the iphone photo library, and i want to use them in my application, but not by selecting them, i want it to work automatically. so i run the开发者_开发知识库 app, and the thumbnails will appear in the middle of the screen in a scrollable tableview. (5 thumbs in each "page"). Like this: http://cl.ly/0z2m261J2I0B461n2L25
what is the best way to do it? Oh , and of course if a user touch a thumnail the large image will appear in a different view.
- Create an
ALAssetsLibrary
instance. - Send a
enumerateGroupsWithTypes:usingBlock:failureBlock:
message to your assets library object. - In the block, you are passed an
ALAssetsGroup
instance over which you again iterate withenumerateAssetsUsingBlock:
. - In that block, you get an
ALAsset
that you can then ask for itsthumbnail
(aCGImageRef
) or itsrepresentation
(an instance ofALAssetRepresentation
), which in turn you can get an image to display from.
精彩评论