Workaround [Re: NSTextView refuses to scroll inside of an NSCollectionView]
Workaround [Re: NSTextView refuses to scroll inside of an NSCollectionView]
- Subject: Workaround [Re: NSTextView refuses to scroll inside of an NSCollectionView]
- From: "email@hidden" <email@hidden>
- Date: Sat, 6 Mar 2010 22:33:58 -0800
For the archives-
I ran into the problem where NSScrollviews from an NSCollectionViewItem's template view do not work properly in a collection view. This is a problem that was reported on this list back in 2007, and reported as a bug then, but is still broken in 10.6.2. I couldn't find a solution online so crafted one of my own.
My gift to future coders who run into this problem:
@interface CBScrollView:NSScrollview
{
}
@end
@implementation CBScrollView
- (void) fixScrollerTargets
{
if ([self verticalScroller] && [[self verticalScroller] target] != self)
{
[[self verticalScroller] setTarget:self];
}
if ([self horizontalScroller] && [[self horizontalScroller] target] != self)
{
[[self horizontalScroller] setTarget:self];
}
}
- (id)initWithCoder:(NSCoder *)decoder
{
if (self = [super initWithCoder:decoder])
{
[self performSelector:@selector(fixScrollerTargets) withObject:nil afterDelay:0];
}
return self;
}
- (void) dealloc
{
[NSObject cancelPreviousPerformRequestsWithTarget:self
selector:@selector(fixScrollerTargets)
object:nil];
[super dealloc];
}
@end
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden