Skip to content
Adds a linen pattern behind scrollviews like in Apple's Lion apps.
Objective-C
Latest commit 97cff06 Nov 30, 2012 @kgn Merge pull request #4 from mikeabdullah/patch-2
Less fragile way to locate scrollview
Failed to load latest commit information.
SampleApp
.gitignore Initial commit Dec 19, 2011
LICENSE adding license Jan 24, 2012
LNClipView.h
LNClipView.m
README.md
Screenshot.png

README.md

LinenClipView provides a subclass of NSScrollView and WebView that displays a linen pattern in the clip view like many of Apple's Lion apps. This library can of course be used to display any background image.


In Interface Builder change the Class of an NSScrollView to LNScrollView or similarly change the Class of a WebView to LNWebView.

These classes can also be created via code with initWithFrame.

To set the pattern image simply call setPattern on either subclass:

[self.tableScrollView setPattern:[NSImage imageNamed:@"pattern11"]];
[self.webView setPattern:[NSImage imageNamed:@"pattern3"]];

The sample project that ships with this project demonstrates this.


Special thanks to @Dimillian for figuring out how to keep the pattern stationary([NSGraphicsContext setPatternPhase:]) and @caffeinatedapp for figuring out a fix to the scrollbars on Lion(the complicated hitTest code).

The background patterns included with this project are from @minimalpatterns.

LinenClipView is available under the MIT license. See the LICENSE file for more info.

Something went wrong with that request. Please try again.