Martin Herman
Martin Herman

Reputation: 888

Fade away at top - CALayer mask for UIScrollView

I have a UIScrollView and I want to make it fading away at the top only. The rest would be solid, like I have it at the picture. Just to be clear, I don't want the content to be fading, I want the whole scrollview to fade. The scrollView itself is solidly transparent, but I want that at some point it vanishes... Is this even possible?

How I want it...

I hope that this is clear enough... If I can make it any clearer please write me a comment.

Upvotes: 3

Views: 594

Answers (1)

Fogmeister
Fogmeister

Reputation: 77651

When you say "fade to transparent" what colour is behind the transparency? Is it a black background that will show through?

If so then just stick a UIImageView over the top of the UIScrollView and put an image in there that contains a gradient from 0% opacity to 100% opacity of the background colour.

That way anything that moves up underneath it will looks like it's fading into the background.

Upvotes: 1

Related Questions