Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)imagePickerController:(UIImagePickerController *)picker
- didFinishPickingMediaWithInfo:(NSDictionary *)info
- {
- UIImage *image = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
- attachment = [Utility resizeImg:image];
- [attachNewFileButton setImage:attachment forState:UIControlStateNormal];
- // get the ref url
- NSURL *refURL = [info valueForKey:UIImagePickerControllerReferenceURL];
- // define the block to call when we get the asset based on the url (below)
- ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *imageAsset)
- {
- ALAssetRepresentation *imageRep = [imageAsset defaultRepresentation];
- attachmentName = [imageRep filename];
- [attachNewFileButton setTitle:attachmentName forState:UIControlStateNormal];
- deleteNewAttachmentButton.hidden = NO;
- };
- // get the asset library and fetch the asset based on the ref url (pass in block above)
- ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
- [assetslibrary assetForURL:refURL resultBlock:resultblock failureBlock:nil];
- [self dismissViewControllerAnimated:YES completion:nil];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement