Use of the Xamarin.ios camera function (1): The simplest approach

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.