Skip to content

Instantly share code, notes, and snippets.

@stevestreza
Created July 19, 2009 23:41
Show Gist options
  • Save stevestreza/150082 to your computer and use it in GitHub Desktop.
Save stevestreza/150082 to your computer and use it in GitHub Desktop.
//
// SSScrollView.h
//
/*
Get a delegate callback when the scroll view scrolls.
*/
#import <Cocoa/Cocoa.h>
@class SSScrollView;
@protocol SSScrollViewDelegate
-(void)scrollViewDidScroll:(SSScrollView *)scrollView;
@end
@interface SSScrollView : NSScrollView {
IBOutlet id<SSScrollViewDelegate> delegate;
}
@property (nonatomic,assign) id<SSScrollViewDelegate> delegate;
@end
//
// SSScrollView.m
//
#import "SSScrollView.h"
@implementation SSScrollView
@synthesize delegate;
- (void)reflectScrolledClipView:(NSClipView *)aClipView{
[super reflectScrolledClipView:aClipView];
if(delegate && [delegate respondsToSelector:@selector(scrollViewDidScroll:)]){
[delegate scrollViewDidScroll:self];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment