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.
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.
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.