【发布时间】:2015-06-27 15:25:01
【问题描述】:
我环顾四周,找不到答案,如果有人问过这个问题,我深表歉意。
我想创建一个工具栏形状的视图,虽然不是一个实际的工具栏,因为侧边菜单无法使用 iOS8 的新实时模糊效果覆盖工具栏(FrostedSidebar),因此呈现的预览是模糊的,工具栏结束了。我的预览会话如下:
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)
}
}
我尝试了以下方法但没有成功:
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)
我对 swift 比较陌生,所以代码示例会很有帮助! 提前致谢!
【问题讨论】:
-
你有解决办法吗,我也在尝试这样的方法
标签: ios swift avfoundation uiblureffect