Chris Chris - 17 days ago 7
Objective-C Question

Fade out top and bottom of an NSScrollView

Is there any way to make the top and bottom edges of an NSScrollView to fade to transparent? I've seen some code/answers that 'fades' it by adding a gradient of a certain color to the subview, basically, covering up the top and bottom with the background color. However, I would like it to actually fade to alpha=0, so you can actually see the contents of the view behind the scroll view. I'm planning my app to have various backgrounds behind this NSScrollView, and without any kind of transition on the borders it looks pretty cheap.

Answer

Here is a ready-made bottom & top fade for you:

https://github.com/jnozzi/JLNFadingScrollView

You can configure its fade color (usually a gray/black for shadow or the scroll view’s background color for ‘fade-to-nothing’)

Comments