适用于iOS6之后的苹果提供的下拉刷新
一:iOS6.0及以后:
- 下拉刷新控件UIRefreshControl
- TableView属性:refreshControl
二:使用
- (void)colseTheTB
{
[self dismissViewControllerAnimated:YES completion:nil];
} - (void)viewDidLoad
{
[super viewDidLoad]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonItemStylePlain target:self action:@selector(colseTheTB)]; //数据源
self.dataArray = [[NSMutableArray alloc]initWithCapacity:];
for (int i = ; i < ; i ++) {
[_dataArray addObject:[NSString stringWithFormat:@"%d",i]];
} //适用于 iOS6 之后,系统自带的下拉刷新控件 UIRefreshControl
UIRefreshControl *osRefresh = [[UIRefreshControl alloc]init];
osRefresh.tintColor = [UIColor lightGrayColor];
osRefresh.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];
[osRefresh addTarget:self action:@selector(doPullRefresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = osRefresh; } - (void)doPullRefresh:(UIRefreshControl *)refresh
{
if (refresh.refreshing) {
refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@"正在刷新"];
[self performSelector:@selector(handleTheRefresh) withObject:nil afterDelay:];
} else
{
refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@"释放刷新"]; }
} - (void)handleTheRefresh
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MMM d, h:mm:ss a"];
NSString *lastUpdated = [NSString stringWithFormat:@"时间:%@", [formatter stringFromDate:[NSDate date]]];
self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastUpdated] ; static int num = ;
num--;
[_dataArray insertObject:[NSString stringWithFormat:@"%d",num] atIndex:]; [self.refreshControl endRefreshing];
[self.tableView reloadData];
}
三:显示情况
- 在iOS6上显示情况,请参见 qq for iPhone版本 app
- 在iOS7 显示情况,是菊花动画,一片一片的铺满
适用于iOS6之后的苹果提供的下拉刷新的更多相关文章
- google官方提供的下拉刷新控件SwipeRefreshLayout
摘自:http://www.stormzhang.com/android/2014/03/29/android-swiperefreshlayout/ SwipeRefreshLayout Swipe ...
- Android官方提供的下拉刷新控件——SwipeRefreshLayout
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=&q ...
- Android开发学习之路-下拉刷新怎么做?
因为最近的开发涉及到了网络读取数据,那么自然少不了的就是下拉刷新的功能,搜索的方法一般是自己去自定义ListView或者RecyclerView来重写OnTouch或者OnScroll方法来实现手势的 ...
- AlloyTouch实现下拉刷新
原文地址:https://github.com/AlloyTeam/AlloyTouch/wiki/Pull-to-refresh 效果展示 扫码体验 你也可以点击这里访问Demo 可以点击这里查看代 ...
- google官方的下拉刷新+自定义上拉加载更多
转载请标注转载:http://blog.csdn.net/oqihaogongyuan/article/details/50949118 google官方的下拉刷新+自定义上拉加载更多 现在很多app ...
- z-tree官方提供的下拉菜单案例
1.z-tree官方提供的下拉菜单案例 <!DOCTYPE html> <HTML> <HEAD> <TITLE> ZTREE DEMO - selec ...
- 打造通用的Android下拉刷新组件(适用于ListView、GridView等各类View)
前言 近期在做项目时,使用了一个开源的下拉刷新ListView组件.极其的不稳定,bug还多.稳定的组件又写得太复杂了,jar包较大.在我的一篇博客中也讲述过下拉刷新的实现,即Android打造(Li ...
- Android 下拉刷新框架实现
原文地址:http://blog.csdn.net/leehong2005/article/details/12567757 前段时间项目中用到了下拉刷新功能,之前在网上也找到过类似的demo,但这些 ...
- Android-PullToRefresh下拉刷新库基本用法
How:(使用) 转自:http://blog.csdn.net/hantangsongming/article/details/42490277 PullToRefresh是一套实现非常好的下拉刷新 ...
随机推荐
- 转:java-Servlet开发
转:http://www.cnblogs.com/xdp-gacl/p/3760336.html 一.Servlet简介 Servlet是sun公司提供的一门用于开发动态web资源的技术. Sun公司 ...
- 【转载】RecyclerView使用全解析
崇拜下鸿洋大神,原文地址:http://blog.csdn.net/lmj623565791/article/details/45059587 概述 RecyclerView出现已经有一段时间了,相信 ...
- POJ 1062 昂贵的聘礼 【带限制的最短路/建模】
年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家拿不出这么多金币,便请求酋长降低要求.酋长说:" ...
- AndroidManifest.xml文件详解(permission-group)
http://blog.csdn.net/think_soft/article/details/7578760 语法(SYNTAX): <permission-groupandroid:desc ...
- Bzoj3837 [Pa2013]Filary(随机化)
题面 权限题 题解 这题有一个很好的性质,就是一定有$k>\frac n2$.接着考虑怎么做. 我们随机选取一个数$x$,然后将所有数与它作差,那么只需要找出$k$个差值使得他们的最大公因数大于 ...
- 【kubernetes】ubuntu14.04 64位 搭建kubernetes过程
背景: Kubernetes介绍:http://kubernetes.io/docs/getting-started-guides/ github地址:https://github.com/kuber ...
- Python - 字符和字符值之间的转换
字符和字符值之间的转换 Python中, 字符和字符值, 直接的转换, 包含ASCII码和字母之间的转换,Unicode码和数字之间的转换; 也可以使用map, 进行批量转换, 输出为集合, 使用jo ...
- AGC 022 B - GCD Sequence
题面在这里! 锻炼脑子的小构造题... 一开始被 a[]<=30000 且 序列 gcd = 1所困扰,但是发现这并没有什么,因为我接下来发现了一种总是能构造出 序列和是6的倍数的方案. 首先如 ...
- 内网中让其他人访问我电脑上的asp.net应用程序
打开防火墙,高级配置,新建入站规则,选择“端口”,下一步,填写特定本地端口,然后都是点击下一步,命名规则,到此,内网中的其他人可以访问你的程序了
- Codeforces Round #345 (Div. 2) A. Joysticks dp
A. Joysticks 题目连接: http://www.codeforces.com/contest/651/problem/A Description Friends are going to ...