Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vvusu/lnrefresh
轻量级下拉刷新控件,各种动画集合(京东,天猫,淘宝,考拉海购,美团,今日头条,飞猪)
https://github.com/vvusu/lnrefresh
objective-c
Last synced: 5 days ago
JSON representation
轻量级下拉刷新控件,各种动画集合(京东,天猫,淘宝,考拉海购,美团,今日头条,飞猪)
- Host: GitHub
- URL: https://github.com/vvusu/lnrefresh
- Owner: vvusu
- License: other
- Created: 2017-07-26T06:47:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T12:51:20.000Z (almost 3 years ago)
- Last Synced: 2024-12-31T21:08:14.337Z (12 days ago)
- Topics: objective-c
- Language: Objective-C
- Homepage:
- Size: 32.6 MB
- Stars: 340
- Watchers: 13
- Forks: 39
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Demo -
Installation -
Documents -
Contribution
# LNRefresh
LNRefresh Is a lightweight, can dynamically expand the drop-down refresh component#### Support what kinds of controls to refresh
`UIScrollView`、`UITableView`、`UICollectionView`、`UIWebView`、`UITextView`## Demo
GIF picture from [华尔街见闻](https://wallstreetcn.com/)| Style | Demo |
| --- | --- |
| Usually style | ![](./images/demo_1.gif) |
| Dynamically change the style | ![](./images/demo_2.gif) |## Customize Demos
| APP | Demo |
| --- | --- |
| 京东 | ![](./images/demo_jd.gif) |
| 天猫 | ![](./images/demo_tmall.gif) |
| 淘宝 | ![](./images/demo_taobao.gif) |
| 考拉海购 | ![](./images/demo_kaola.gif) |
| 美团外卖 | ![](./images/demo_meituan.gif) |
| 网易新闻 | ![](./images/demo_neteasenews.gif) |
| 今日头条 | ![](./images/demo_toutiao.gif) |
| 飞猪 | ![](./images/demo_feizhu.gif) |## Installation
### CocoaPods
Installation with CocoaPods:```
pod 'LNRefresh'
```
### Carthage
Installation with Cartfile:```
github "wszoo/LNRefresh"
```
## Documents
#### How to use LNRefresh
###### Add pull to refresh
```
__weak typeof (self) wself = self;
//UITableView
[self.tableView addPullToRefresh:^{
[wself pullToRefresh];
}];//UICollectionView
[self.collectionView addPullToRefresh:^{
[wself pullToRefresh];
}];//UIWebView
[self.webView.scrollView addPullToRefresh:^{
[wself.webView reload];
}];
```
###### End Pull to refresh
```
//UITableView
[self.tableView endRefreshing];//UICollectionView
[self.collectionView endRefreshing];//UIWebView
[self.webView.scrollView endRefreshing];
```
###### Add Loading more
```
//UITableView
[self.tableView addInfiniteScrolling:^{
[wself loadMoreRefresh];
}];//UICollectionView
[self.collectionView addInfiniteScrolling:^{
[wself loadMoreRefresh];
}];
```
###### End Loading more
```
//UITableView
[self.tableView endLoadingMore];//UICollectionView
[self.tableView endLoadingMore];
```
###### No More data
```
//UITableView
[self.tableView noticeNoMoreData];//UICollectionView
[self.tableView noticeNoMoreData];
```
###### Auto Refresh
```
[self.scrollView startRefreshing];
```
###### Change the trigger to pull the refresh distance
```
self.tableView.ln_header.animator.trigger = 100;
```#### Global Settings
###### Set the GIF image
```
+ (void)setAllHeaderAnimatorStateImages:(NSArray *)stateImages
state:(LNRefreshState)state;+ (void)setAllHeaderAnimatorStateImages:(NSArray *)stateImages
state:(LNRefreshState)state
duration:(NSTimeInterval)duration;
```
###### Change the global pull-down refresh pattern state
```
+ (void)changeAllHeaderAnimatorType:(LNRefreshHeaderType)type;+ (void)changeAllHeaderAnimatorType:(LNRefreshHeaderType)type
bgImage:(UIImage *)image;+ (void)changeAllHeaderAnimatorType:(LNRefreshHeaderType)type
bgImage:(UIImage *)image
incremental:(CGFloat)incremental;
```#### Customize RefreshAnimator
You Need to inherit LNHeaderAnimator,Rewrite the following method.```
- (void)setupHeaderView_DIY;
- (void)layoutHeaderView_DIY;
- (void)refreshHeaderView_DIY:(LNRefreshState)state;
- (void)refreshView_DIY:(LNRefreshComponent *)view progress:(CGFloat)progress;
```
Example: `LNHeaderDIYAnimator.m`#### Analysis
Example: `LNHeaderAnimator+Analysis.m`## Contribution
[vvusu](https://github.com/wedxz)
## LicenseCopyright (c) 2017 vvusu