A twitter-style pull-to-refresh NSScrollView with the added functionality of delegate protocols.
A slightly modified version of: Leah Culver's PullToRefresh and Alex Zielenski's ScrollToRefresh
- Elastic Scroll
- Added optional delegate protocol method:
ptrScrollViewDidTriggerRefresh:(id)sender
- This method gets called when the user scrolls beyond the set bounds.
- Link against the QuartzCore framework (under Targets > Build Phases > Link Binarry With Libraries).
- Copy the following files to your project:
- PullToRefreshClipView.h/PullToRefreshClipView.m;
- PullToRefreshScrollView.h/PullToRefreshScrollView.m;
- PullToRefreshDelegate.h;
- pull-to-refresh-arrow.png and;
- release-to-refresh.png.
- Add a TableView or OutlineView from the Object Library to your nib file and subclass the ScrollView as a PullToRefreshScrollView.
- Create an outlet in your controller:
@property (weak) IBOutlet PullToRefreshScrollView *ptrScrollView;
- Set the delegate:
- (void)awakeFromNib {
NSLog(@"awake from nib");
[_ptrScrollView setDelegate:self];
}
- Add the delegate method:
- (void)ptrScrollViewDidTriggerRefresh:(id)sender {
NSLog(@"This is called by the PullToRefresh delegate protocol");
}
- Customize the delegate method as needed.
PullToRefresh is forked from Alex Zielenski's ScrollToRefresh and is licensed under the MIT License. Please refer to the LICENSE for further details.