UIVisualEffectView and UITableView

940 views Asked by At

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

normal scrolling

2

There are 2 answers

0
thomasguenzel On

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()
}
1
Kirit Modi On

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.

enter image description here

SWIFT

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