In this recipe, we will discuss how to programmatically access the device's photo album.
Perform the following steps:
Add a button on the main view of the controller.
Enter the following
using
directive in theMainController.cs
file:using MonoTouch.AssetsLibrary;
Add the following code in the
ViewDidLoad
method:this.btnEnumerate.TouchUpInside += (s, e) => { if (ALAssetsLibrary.AuthorizationStatus == ALAuthorizationStatus.Authorized || ALAssetsLibrary.AuthorizationStatus == ALAuthorizationStatus.NotDetermined) { this.assetsLibrary = new ALAssetsLibrary(); this.assetsLibrary.Enumerate(ALAssetsGroupType.All, this.GroupsEnumeration, this.GroupsEnumerationFailure); } } ;
Add the following methods in the class:
private void GroupsEnumeration...