Created
October 3, 2013 08:01
-
-
Save loic/6806666 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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