iOS swift 模糊和圆图形特效

class ViewController: UIViewController {
    
    
    @IBOutlet weak var img: UIImageView!
    
    
    @IBOutlet weak var bg: UIImageView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        img.layer.cornerRadius = 90
        img.clipsToBounds = true
        
        
        let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light)
        
        let visualEffectView = UIVisualEffectView(effect: blurEffect)
        
        
        visualEffectView.frame.size = CGSize(width: self.view.frame.width, height: self.view.frame.height)
        
        bg.addSubview(visualEffectView)
    }

}







你可能感兴趣的:(模糊,圆图形特效)