IOS gives us a few different ways to use the camera and save it in a photo album.
Xamarin.ios It is also possible to use this method quickly, using the camera function.
Before that we can get a little bit of the basic structure, as shown below.
If you have a DirectX (DirectInput) or OpenGL ES operator experience, you can find that the basic concept is not much worse.
is from the access device start, to the ready to receive the output of the byte[] and management, to determine the format of the output.
Let's now use the simplest uiimagepickercontroller to present the camera function
Btnuiimagepickerviewcontroller.touchupinside + = (Objectsender, EventArgs e) = ={Uiimagepickercontroller Imagepickerviewcontroller; Imagepickerviewcontroller=NewUiimagepickercontroller (); Imagepickerviewcontroller.sourcetype=Uiimagepickercontrollersourcetype.camera; Imagepickerviewcontroller.mediatypes=uiimagepickercontroller.availablemediatypes (uiimagepickercontrollersourcetype.photolibrary); Imagepickerviewcontroller.finishedpickingmedia+= (ObjectQsender, Uiimagepickermediapickedeventargs IE) ={resultimageview.image=ie. Originalimage; Imagepickerviewcontroller.dismissviewcontrollerasync (true ); }; Imagepickerviewcontroller.canceled+= (ObjectPsender, EventArgs pe) ={Imagepickerviewcontroller.dismissviewcontrollerasync (true ); }; Presentviewcontroller (Imagepickerviewcontroller,true,NULL); };
Where Btnuiimagepickerviewcontroller is the UIButton text placed on the view Camera-uiimagepickerviewcontroller, Resultimageview It's a uiimageview on the view.
This way, you can quickly complete the ability to take pictures using camera uiimagepickerviewcontroller.
Use of the Xamarin.ios camera function (1): The simplest approach