Skip to content

Instantly share code, notes, and snippets.

@loic
Created October 3, 2013 08:01
Show Gist options
  • Save loic/6806666 to your computer and use it in GitHub Desktop.
Save loic/6806666 to your computer and use it in GitHub Desktop.
var imagePicker = new UIImagePickerController();
var actionSheet = new UIActionSheet (null, null, "Cancel", null, new string[] {"Take photo", "Choose Existing"});
actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
if (b.ButtonIndex == 0) {
imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
} else if (b.ButtonIndex == 1) {
imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
}
if (b.ButtonIndex != actionSheet.CancelButtonIndex) {
NavigationController.PresentViewController(imagePicker, true, null);
}
};
actionSheet.ShowFromTabBar(TabBarController.TabBar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment