我想像应用程序一样在全屏上设置模糊效果
这是我的代码我想设置模糊效果
let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
filePathToWrite1 = "\(paths)/\(videoTitle[a]).jpg"
let img = UIImage(contentsOfFile: filePathToWrite1)
viewImg.image = img
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = viewImg.bounds
blurEffectView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
viewImg.addSubview(blurEffectView)
view.addSubview(viewImg)
这是我的原始img的img
后模糊效果
我想喜欢下面
最佳答案
将此代码放在viewImg.image = img
下:
viewImg.contentMode = .ScaleAspectFill
关于ios - swift 设置全屏模糊效果,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35216974/