I made an Xamarin.iOS app where I have a camera stream. In my storyboard I have a UIButton to take a picture and one to switch the cameras.
But when I start my app the buttons are under the camera stream.
Does someone know how to place the buttons over the camera stream?
Here is my code
public override void ViewDidLoad()
{
base.ViewDidLoad();
liveCameraStream = PhotoView;
SetupLiveCameraStream();
}
public void SetupLiveCameraStream()
{
captureSession = new AVCaptureSession();
var viewLayer = liveCameraStream.Layer;
var videoPreviewLayer = new AVCaptureVideoPreviewLayer(captureSession)
{
Frame = liveCameraStream.Bounds
};
liveCameraStream.Layer.AddSublayer(videoPreviewLayer);
var captureDevice = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video);
ConfigureCameraForDevice(captureDevice);
captureDeviceInput = AVCaptureDeviceInput.FromDevice(captureDevice);
var dictionary = new NSMutableDictionary();
dictionary[AVVideo.CodecKey] = new NSNumber((int)AVVideoCodec.JPEG);
stillImageOutput = new AVCaptureStillImageOutput()
{
OutputSettings = new NSDictionary()
};
captureSession.AddOutput(stillImageOutput);
captureSession.AddInput(captureDeviceInput);
captureSession.StartRunning();
}