Random snippets of useful code: MacOS scrolling edition.

The fact that scrolling by default places things in the lower left (instead of upper left) seems brain dead to me. Fortunately it’s easy to flip things internally for your application. Just add the following snippet of code to one of your views, and things will work out just fine:

//	Clip view, causes scroll contents to grow from top

@interface NSClipView (Private)
- (BOOL)isFlipped;
@end

@implementation NSClipView (Private)
- (BOOL)isFlipped
{
	return YES;
}
@end

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s