0

I'm trying to achieve an effect similar to the one shown in the gif below.

I put an image in the background and a scroll view over it.

However, it confuses me as to how to blur the background image when i begin scrolling.

please advise.

enter image description here

Walking
  • 335
  • 5
  • 23

1 Answers1

0

You can do something like this, add a blur subview to imageView when scroll begin:

func scrollViewDidScroll(scrollView: UIScrollView) {
    var visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light))

    visualEffectView.frame = yourIimageView.bounds

    yourImageView.addSubview(visualEffectView)

}

You may also want to track the direction of scroll, so when you scroll up, the blur show up, when scroll down, the blur disappear. You can have a look at this post to see how to detect it.

ios UICollectionView detect scroll direction

Community
  • 1
  • 1
ilovecomputer
  • 3,250
  • 17
  • 32