|
1 | 1 | # SVPullToRefresh + SVInfiniteScrolling
|
2 | 2 |
|
3 |
| -These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities to any UIScrollView (or any of its subclass). Instead of relying on delegates and/or subclassing `UIViewController`, SVPullToRefresh uses the Objective-C runtime to add the following 2 methods to `UIScrollView`: |
| 3 | +These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities to any UIScrollView (or any of its subclass). Instead of relying on delegates and/or subclassing `UIViewController`, SVPullToRefresh uses the Objective-C runtime to add the following 3 methods to `UIScrollView`: |
4 | 4 |
|
5 | 5 | ```objective-c
|
6 | 6 | - (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler;
|
| 7 | +- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler position:(SVPullToRefreshPosition)position; |
7 | 8 | - (void)addInfiniteScrollingWithActionHandler:(void (^)(void))actionHandler;
|
8 | 9 | ```
|
9 | 10 |
|
@@ -33,6 +34,14 @@ _**Important note if your project doesn't use ARC**: you must add the `-fobjc-ar
|
33 | 34 | // call [tableView.pullToRefreshView stopAnimating] when done
|
34 | 35 | }];
|
35 | 36 | ```
|
| 37 | +or if you want pull to refresh from the bottom |
| 38 | +
|
| 39 | +```objective-c |
| 40 | +[tableView addPullToRefreshWithActionHandler:^{ |
| 41 | + // prepend data to dataSource, insert cells at top of table view |
| 42 | + // call [tableView.pullToRefreshView stopAnimating] when done |
| 43 | +} position:SVPullToRefreshPositionBottom]; |
| 44 | +``` |
36 | 45 |
|
37 | 46 | If you’d like to programmatically trigger the refresh (for instance in `viewDidAppear:`), you can do so with:
|
38 | 47 |
|
@@ -112,4 +121,4 @@ SVPullToRefresh is brought to you by [Sam Vermette](http://samvermette.com) and
|
112 | 121 |
|
113 | 122 | Big thanks to [@seb_morel](http://twitter.com/seb_morel) for his [Demistifying the Objective-C runtime](http://cocoaheadsmtl.s3.amazonaws.com/demistifying-runtime.pdf) talk which really helped for this project.
|
114 | 123 |
|
115 |
| -Hat tip to [Loren Brichter](http://twitter.com/lorenb) for inventing pull-to-refresh. |
| 124 | +Hat tip to [Loren Brichter](http://twitter.com/lorenb) for inventing pull-to-refresh. |
0 commit comments