The JLNFadingScrollView project is a simple drop-in Objective-C / Cocoa NSScrollView subclass that provides a visual fade effect at the top and bottom of scrolled content, giving a visual sense of the content fading as it nears the top or bottom edge. Several examples of various fade height and color configurations are below.
JLNFadingScrollView is a drop-in subclass of NSScrollView that adds a top and bottom fade of scrolled content (a la Dictionary.app’s left-hand term source list). You can configure its fade color (usually a gray/black for shadow or the scroll view’s background color for ‘fade-to-nothing’) and the fade height (small for shadow look, very large for iPhone-style-rolling-wheel effect).
- Copy JLNFadingScrollView.m and JLNFadingScrollView.h into your project.
- In Interface Builder, set the class name of the desired NSScrollView to JLNFadingScrollView.
- Include JLNFadingScrollView.h into any file in which you want to communicate with the scroll view (to configure its fade color/height).
- Call -setFadeColor: and/or -setFadeHeight: to configure to taste
This source code is free to use in any private, public, or commercial software products with attribution. See License.txt that accompanies the source file for details.
The code is hosted entirely on Github. Click here to visit the repository.