问题描述
我在相机ViewController中有一个blurEffect,每当我从一个ViewController传递到另一个时,我都会使用它来模糊cameraview。
我这样做,为它的alpha值设置动画。
这些是模糊效果变量:
var blur = UIBlurEffect(style: .dark)
var blurView = UIVisualEffectView()
我希望当应用程序在后台或前台进入时,我可以访问属性并更改Alpha值。
这是我在SceneDelegate中所做的:
func sceneWillEnterForeground(_ scene: UIScene) {
guard let cameraviewController = tabbarviewcontroller.viewControllers[1].viewControllers.first as? CameraviewController else{
print("there is an error in retrieving the cameraController")
return
}
UIView.animate(withDuration: 0.25,delay: 0.2,options: [.curveEaSEOut,. allowUserInteraction],animations: {
cameraviewController.blurView.alpha = 0
})
}
func sceneDidEnterBackground(_ scene: UIScene) {
guard let cameraviewController = tabbarviewcontroller.viewControllers[1].viewControllers.first as? CameraviewController else{
print("there is an error in retrieving the cameraController")
return
}
cameraviewController.blurView.alpha = 1
}
我可以正确访问cameraviewController,但是blurView.alpha动画不起作用,关于什么可能导致此问题的建议?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)