{"id":2705,"url":"https://github.com/samvermette/SVPullToRefresh","last_synced_at":"2025-08-03T00:32:28.044Z","repository":{"id":3092978,"uuid":"4117751","full_name":"samvermette/SVPullToRefresh","owner":"samvermette","description":"Give pull-to-refresh \u0026 infinite scrolling to any UIScrollView with 1 line of code. ","archived":false,"fork":false,"pushed_at":"2023-12-08T00:03:50.000Z","size":960,"stargazers_count":4822,"open_issues_count":151,"forks_count":1093,"subscribers_count":170,"default_branch":"master","last_synced_at":"2024-12-06T11:35:21.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://samvermette.com/314","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samvermette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2012-04-23T20:50:15.000Z","updated_at":"2024-12-02T11:20:19.000Z","dependencies_parsed_at":"2024-01-05T20:20:14.633Z","dependency_job_id":"0b90e98e-7ba5-4499-b583-0c1f92563d4b","html_url":"https://github.com/samvermette/SVPullToRefresh","commit_stats":{"total_commits":121,"total_committers":37,"mean_commits":3.27027027027027,"dds":0.5123966942148761,"last_synced_commit":"a5f9dfee86a27c4e994d7edf93d0768c881d58bb"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvermette%2FSVPullToRefresh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvermette%2FSVPullToRefresh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvermette%2FSVPullToRefresh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samvermette%2FSVPullToRefresh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samvermette","download_url":"https://codeload.github.com/samvermette/SVPullToRefresh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228510777,"owners_count":17931761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:20.658Z","updated_at":"2024-12-06T18:30:42.819Z","avatar_url":"https://github.com/samvermette.png","language":"Objective-C","readme":"# SVPullToRefresh + SVInfiniteScrolling\n\nThese 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`:\n\n```objective-c\n- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler;\n- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler position:(SVPullToRefreshPosition)position;\n- (void)addInfiniteScrollingWithActionHandler:(void (^)(void))actionHandler;\n```\n\n## Installation\n\n### From CocoaPods\n\nAdd `pod 'SVPullToRefresh'` to your Podfile or `pod 'SVPullToRefresh', :head` if you're feeling adventurous.\n\n### Manually\n\n_**Important note if your project doesn't use ARC**: you must add the `-fobjc-arc` compiler flag to `UIScrollView+SVPullToRefresh.m` and `UIScrollView+SVInfiniteScrolling.m` in Target Settings \u003e Build Phases \u003e Compile Sources._\n\n* Drag the `SVPullToRefresh/SVPullToRefresh` folder into your project.\n* Add the **QuartzCore** framework to your project.\n* Import `UIScrollView+SVPullToRefresh.h` and/or `UIScrollView+SVInfiniteScrolling.h`\n\n## Usage\n\n(see sample Xcode project in `/Demo`)\n\n### Adding Pull to Refresh\n\n```objective-c\n[tableView addPullToRefreshWithActionHandler:^{\n    // prepend data to dataSource, insert cells at top of table view\n    // call [tableView.pullToRefreshView stopAnimating] when done\n}];\n```\nor if you want pull to refresh from the bottom\n\n```objective-c\n[tableView addPullToRefreshWithActionHandler:^{\n    // prepend data to dataSource, insert cells at top of table view\n    // call [tableView.pullToRefreshView stopAnimating] when done\n} position:SVPullToRefreshPositionBottom];\n```\n\nIf you’d like to programmatically trigger the refresh (for instance in `viewDidAppear:`), you can do so with:\n\n```objective-c\n[tableView triggerPullToRefresh];\n```\n\nYou can temporarily hide the pull to refresh view by setting the `showsPullToRefresh` property:\n\n```objective-c\ntableView.showsPullToRefresh = NO;\n```\n\n#### Customization\n\nThe pull to refresh view can be customized using the following properties/methods:\n\n```objective-c\n@property (nonatomic, strong) UIColor *arrowColor;\n@property (nonatomic, strong) UIColor *textColor;\n@property (nonatomic, readwrite) UIActivityIndicatorViewStyle activityIndicatorViewStyle;\n\n- (void)setTitle:(NSString *)title forState:(SVPullToRefreshState)state;\n- (void)setSubtitle:(NSString *)subtitle forState:(SVPullToRefreshState)state;\n- (void)setCustomView:(UIView *)view forState:(SVPullToRefreshState)state;\n```\n\nYou can access these properties through your scroll view's `pullToRefreshView` property.\n\nFor instance, you would set the `arrowColor` property using:\n\n```objective-c\ntableView.pullToRefreshView.arrowColor = [UIColor whiteColor];\n```\n\n### Adding Infinite Scrolling\n\n```objective-c\n[tableView addInfiniteScrollingWithActionHandler:^{\n    // append data to data source, insert new cells at the end of table view\n    // call [tableView.infiniteScrollingView stopAnimating] when done\n}];\n```\n\nIf you’d like to programmatically trigger the loading (for instance in `viewDidAppear:`), you can do so with:\n\n```objective-c\n[tableView triggerInfiniteScrolling];\n```\n\nYou can temporarily hide the infinite scrolling view by setting the `showsInfiniteScrolling` property:\n\n```objective-c\ntableView.showsInfiniteScrolling = NO;\n```\n\n#### Customization\n\nThe infinite scrolling view can be customized using the following methods:\n\n```objective-c\n- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle;\n- (void)setCustomView:(UIView *)view forState:(SVInfiniteScrollingState)state;\n```\n\nYou can access these properties through your scroll view's `infiniteScrollingView` property. \n\n## Under the hood\n\nSVPullToRefresh extends `UIScrollView` by adding new public methods as well as a dynamic properties. \n\nIt uses key-value observing to track the scrollView's `contentOffset`.\n\n## Credits\n\nSVPullToRefresh is brought to you by [Sam Vermette](http://samvermette.com) and [contributors to the project](https://github.com/samvermette/SVPullToRefresh/contributors). If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/samvermette/SVPullToRefresh/issues/new). If you're using SVPullToRefresh in your project, attribution would be nice. \n\nBig 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. \n\nHat tip to [Loren Brichter](http://twitter.com/lorenb) for inventing pull-to-refresh.","funding_links":[],"categories":["UI","Objective-C","Object-C 库","etc"],"sub_categories":["Pull to Refresh","Layout","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvermette%2FSVPullToRefresh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamvermette%2FSVPullToRefresh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamvermette%2FSVPullToRefresh/lists"}