现用代码:
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
效果:
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
Is the logic of adding this part of code placed after the cell appears?