我正在使用Sketch 3,我创建了一个矩形,我将不透明度设为70%,并为其提供了20%的背景模糊。当我将这个图像添加到我的项目并尝试在Xcode上使用时,模糊从图像中消失,我留下了一些我没有创建的东西,一个没有模糊的透视图像。可能会发生什么?
func createBlurImageView() {
guard let imageView: UIImageView = UIImageView(frame: self.window!.bounds) else {
return
}
imageView.tag = 1000
imageView.image = UIImage(named: "Rectangle136")
self.window!.addSubview(imageView)
self.window!.bringSubviewToFront(imageView)
UIView.animateWithDuration(0.4, animations: {() -> Void in
imageView.alpha = 0.8
})
}
func removeBlurImageView() {
guard let imageView = self.window?.viewWithTag(1000) as? UIImageView else {
print("No good")
return
}
UIView.animateWithDuration(0.4, animations: {() -> Void in
imageView.alpha = 0
}, completion: {(finished: Bool) -> Void in
// remove when finished fading
imageView.removeFromSuperview()
})
}