SmartRefreshControl 是 SmartRefreshLayout 的IOS版,和Android版在 理念
和 外观
上面保留相同的设计,但是由于 Android 和 IOS 两个系统的差别,IOS版本在功能使用和特性上与安卓版有所差别。刷新控件使用 ObjectiveC 语言编写,演示 DemoApp 使用 Swift 语言编写。
目前 SmartRefreshControl
功能还不是很强大,也不太稳定,只是在界面层面实现了安卓版的功能。欢迎大家来体验与发现BUG,不推荐使用在正式项目中。
大学毕业后我大部分时间从事安卓开发,在安卓版 SmartRefresh
大火之后,我开始转型 IOS 开发。到现在已经有三年的IOS开发经验,由于IOS上也还未有像 SmartRefresh
一样同一个开源库多种外观样式的刷新库,也想巩固自己所学的 IOS技能,我决定在闲暇之余把安卓 SmartRefresh
复刻到IOS平台来。经过一年多的努力总算初步完成了。
Delivery | Material |
---|---|
Refresh-your-delivery | MaterialHeader |
BezierRadar | BezierCircle |
---|---|
Pull To Refresh | Pull Down To Refresh |
FlyRefresh | DropBox |
---|---|
FlyRefresh | DropBoxHeader |
Phoenix | Taurus |
---|---|
Yalantis/Phoenix | Yalantis/Taurus |
BattleCity | HitBlock |
---|---|
FunGame/BattleCity | FunGame/HitBlock |
StoreHouse | WaveSwipe |
---|---|
CRefreshLayout | WaveSwipeRefreshLayout |
Original | Classics |
---|---|
FlyRefresh | ClassicsHeader |
pod 'SmartRefreshControl', '~> 0.1.0'
#import <SmartRefreshControl/SmartRefreshControl.h>
@interface DemoTableViewController ()
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) UIRefreshBezierRadarHeader *header;
@end
@implementation DemoTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
//方式1: 初始化同时绑定事件
[self setHeader:[UIRefreshBezierRadarHeader attach:self.tableView target:self action:@selector(onRefresh)]];
//方式2: 先初始化,再绑定事件
[self setHeader:[UIRefreshBezierRadarHeader attach:self.tableView]];
[self.header addTarget:self action:@selector(onRefresh)];
//方式3: 先创建,再绑定
[self setHeader:[UIRefreshBezierRadarHeader new]];
[self.header attach:self.tableView];
[self.header addTarget:self action:@selector(onRefresh)];
}
@end
@implementation DemoTableViewController
- (void)onRefresh {
[self.header finishRefresh]; //关闭刷新,可以改成请求网络,成功/失败之后再关闭刷新
}
@end
MIT License
Copyright (c) 2021 树朾
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.