ios - 为什么设置UITableView的backgroundView在最上层遮挡内容?
PHPz
PHPz 2017-04-17 17:49:57
0
2
328

现用代码:

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

效果:

PHPz
PHPz

学习是最好的投资!

reply all(2)
小葫芦

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?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template