How To add OverlayView in Xamarin IOS Live Camera

前端 未结 2 1689
清酒与你
清酒与你 2020-12-20 06:02
  • I am accessing the live camera but i want to add an overlay above it, to take a specific picture and save the picture insde an overlay.
  • My goal is as shown on
2条回答
  •  心在旅途
    2020-12-20 06:16

    I managed to add CameraOverlayView, "to allow the user to take a picture inside the given rectangle"

    private UIImagePickerController _imagePicker;
    
    private void OpenCameraAndTakePhoto() { 
        _imagePicker = new UIImagePickerController();
        _imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
        _imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.Camera);
        _imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
        _imagePicker.Canceled += Handle_Canceled;
        _imagePicker.ShowsCameraControls = true;
        UIView view = new UIView(new CGRect(30, 200, 250, 120));
        view.Layer.BorderColor = UIColor.Blue.CGColor;
        view.Layer.BorderWidth = 3.0f;
        _imagePicker.CameraOverlayView = view;
    
        PresentModalViewController(_imagePicker, true);
    }
    

提交回复
热议问题