简体   繁体   中英

UIVisualEffectView and UITableView

I've put a UITableView into a UIVisualEffectView to achieve vibrancy. Everything works fine except for the bounce feature. The space where no cells are while scrolling gets drawn in some grey color instead of the blurred effect. I have tried to set all the background colours to clear but the blur still won't show. Is there any way to give the background the same effect as the rest of the table view?

You can find the demo project here

正常滚动

set Clear color of Table view, TableviewCell and ContainerView from Property. if not Clear then put code in your view Controller. also selection of cell none option.

在此处输入图片说明

SWIFT

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
    cell.backgroundColor = UIColor.clearColor()
} 

So I've found the answer. Instead of making the background a clear color, you need to set a white color.

override func viewDidLoad() {
    super.viewDidLoad()

    self.tableView.backgroundColor = UIColor.whiteColor()
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM