现用代码:
let img = UIImage(contentsOfFile: NSBundle.mainBundle().pathForResource("logo", ofType: "png")!)
let bgView = UIImageView()
bgView.image = img
bgView.contentMode = .ScaleAspectFill
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = bgView.bounds
bgView.addSubview(blurView)
self.tableView.backgroundView = bgView
效果:
高洛峰2017-04-17 17:51:57
BackgroundView should be fixed at the bottom layer and cannot be changed
You can use other methods to achieve this effect. If the image can be scrolled, add it directly to the tableView. If it needs to be fixed, it can be added to the tabBar or navigationBar. Use the insertSubview: series method to insert the Control the display level in the parent view