iOS学习-tableView下拉刷新(UIRefreshControl)
来源:互联网 发布:三亚交通运载能力数据 编辑:程序博客网 时间:2024/05/07 04:35
1.相关代码
- (void)viewDidLoad {
[superviewDidLoad];
//初始化变量和时间
self.Logs = [[NSMutableArrayalloc]init];
NSDate *date = [[NSDatealloc]init];
[self.LogsaddObject:date];
//初始化UIRefreshControl
UIRefreshControl *rc = [[UIRefreshControlalloc]init];
rc.attributedTitle = [[NSAttributedStringalloc]initWithString:@"下拉刷新"];
[rc addTarget:selfaction:@selector(refreshTableView)forControlEvents:UIControlEventValueChanged];
self.refreshControl = rc;
}
-(void) refreshTableView {
if (self.refreshControl.refreshing) {
self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"加载中..."];
//添加新的模拟数据
NSDate *date = [[NSDatealloc]init];
[self.LogsaddObject:date];
[self.refreshControlendRefreshing];
self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];
[self.tableViewreloadData];
}
}
2.下拉刷新控件UIRefreshControl只能应用于表视图界面,而且根视图控制器必须是表视图控制器UITableViewController,不能是其他视图控制器。
- iOS学习-tableView下拉刷新(UIRefreshControl)
- iOS 下拉刷新 UIRefreshControl
- 利用UIRefreshControl实现tableView下拉刷新
- ios-下拉刷新UIRefreshControl介绍
- IOS学习之——UIRefreshControl下拉刷新控件
- [iOS] 使用UIRefreshControl 实现 UITableView下拉刷新(Swift版本)
- iOS开发技巧(系列十三:UIRefreshControl下拉刷新)
- iOS开发技巧 UIRefreshControl下拉刷新
- iOS之UIRefreshControl系统下拉刷新
- UIRefreshControl下拉刷新
- 下拉刷新,UIRefreshControl
- UIRefreshControl下拉刷新
- UIRefreshControl 下拉刷新
- UIRefreshControl下拉刷新
- UIRefreshControl 下拉刷新
- UIRefreshControl系统下拉刷新
- swift UIRefreshControl() 下拉刷新
- IOS控件TableView下拉刷新
- linux 批量查找文件并且重命名
- mongdb
- No resource identifier found for attribute 'showAsAction' in package
- 机房收费系统之纠结的组合查询
- key-value的topK问题
- iOS学习-tableView下拉刷新(UIRefreshControl)
- Struts2通配符详解
- 请求报文和响应报文的内容以及属性(404状态)
- PHP判断字符串纯汉字、纯英文、汉英混合
- Java微信支付总结(一):获得prepay_id(以及生成微信支付签名)
- 在ARM CORTEX-M内核上运行FreeRTOS
- 使用Postman玩转接口测试
- 使用getBackground().setAlpha,导致其他布局背景透明度都改变的问题
- Solr使用入门指南