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