"Learn iOS: UI series" Get the name information for a system album picture obtained via Uiimagepackercontroller

Source: Internet
Author: User

Getting the system's photo albums through the Iuimagepickercontroller method requires the following steps to get the picture from the system album:

1: Obtain the assert of the selected photos from Uiimagepicker;

2: Alassertrepresentation to be assert;

3:alassertrepresentation has a filename property.

The code is specific as follows:

This method is a method in the proxy in Uiimagepickercontroller

    -(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info {                Nsurl *imageurl = [info valueforkey:uiimagepickercontrollerreferenceurl];          Alassetslibraryassetforurlresultblock Resultblock = ^ (Alasset *myasset)          {              alassetrepresentation * representation = [Myasset defaultrepresentation];              NSString *filename = [representation fileName];              NSLog (@ "FileName:%@", filename);          };                alassetslibrary* assetslibrary = [[[[Alassetslibrary alloc] init] autorelease];          [Assetslibrary assetforurl:imageurl                          resultblock:resultblock                        failureblock:nil];            }  
Note: To use the above actions, you need to introduce the following content

#import <AssetsLibrary/ALAsset.h> #import <AssetsLibrary/ALAssetsLibrary.h> #import <assetslibrary/ Alassetsgroup.h> #import <AssetsLibrary/ALAssetRepresentation.h>
The following effects:


Original address: click

"Learn iOS: UI series" Get the name information for a system album picture obtained via Uiimagepackercontroller

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.