0

I have the following code:

if !UIAccessibilityIsReduceTransparencyEnabled()
    {
        view.backgroundColor = UIColor(patternImage: UIImage(named: "sunset-photo.jpg")!);

        let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light);
        let blurEffectView = UIVisualEffectView(effect: blurEffect);

        blurEffectView.frame = view.bounds;
        blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight];

        view.addSubview(blurEffectView);
    }
    else
    {
        view.backgroundColor = UIColor(red: 110/255, green: 110/255, blue: 110/255, alpha: 1.0);
    }

    return view;
}

This is fine for regulat UIViews but the table view scrolls. Dragging down then creates a black background and scrolling down shows the image without blur effect. How do I fix this? New to swift by the way.

cdub
  • 24,555
  • 57
  • 174
  • 303

1 Answers1

0

Set the tableview background color to. Clear color

Irshad Ahmad
  • 1,363
  • 11
  • 17
  • Can you specify more? Thanks. – cdub Jun 15 '17 at 03:56
  • I think he means that you should set the table view's background color to clear, and have a view that is behind the table view. The view behind the tableview would then have the image with the blur effect, and you won't see any weird issues when the tableview itself is scrolled. – Msencenb Jun 15 '17 at 04:04