0

I've looked around and couldn't find the answer, so apologies if this has already been asked.

I want to create a view in the shape of a toolbar, although not an actual toolbar since the side menu cannot overlay a toolbar (FrostedSidebar) using iOS8's new realtime blur effect so that the preview that is presented is blurred and the toolbar is over it. My preview session is as follows:

func beginSession() {
    var err : NSError? = nil
    captureSession.addInput(AVCaptureDeviceInput(device: captureDevice, error: &err))

    if err != nil {
        println("error: \(err?.localizedDescription)")
    }

    previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
    self.view.layer.insertSublayer(previewLayer, atIndex: 0)
    //self.view.lay
    previewLayer?.frame = self.view.layer.bounds
    captureSession.startRunning()
    if captureSession.canAddOutput(stillImageOutput) {
        captureSession.addOutput(stillImageOutput)
    }
}

And I've tried the following without any success:

    self.view.addSubview(topBar)
    //UIApplication.sharedApplication().keyWindow?.addSubview(bottomBar)

    previewLayer.bringSubviewToFront(topBar)
    UIApplication.sharedApplication().keyWindow?.bringSubviewToFront(bottomBar)
    self.topBar.addSubview(burgerBtn)
    self.bottomBar.addSubview(cameraBtn)

I'm relatively new to swift so code examples would be very helpful! Thanks in advance!

Kusti8
  • 1
  • 1

1 Answers1

1

Add a UIVisualEffectView on top of your view hierarchy. (add your video layer to another view's layer, then put the UIVisualEffectView on top of that view.)

Duncan C
  • 128,072
  • 22
  • 173
  • 272