Using the camera on iOS

C# example that shows how to trigger the iOS camera:

class RootViewController : UIViewController, IUINavigationControllerDelegate, IUIImagePickerControllerDelegate
{

        public void OpenCamera()
        {
        
            var picker = new UIImagePickerController();
            picker.@delegate = this;
            picker.sourceType = UIImagePickerControllerSourceType.Camera;


            presentViewController(picker) animated(true) completion(null);
        }


        public void imagePickerController(UIImagePickerController picker) didFinishPickingMediaWithInfo(NSDictionary info)
        {
            // picture was taken
        } 

        public public void imagePickerControllerDidCancel(UIImagePickerController picker)
        {
            // user canceled
        }
....
}
1 Like