标签:
1、系统控件UIRefreshControl
使用方法:
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self setupRefresh]; } /** * 集成下拉刷新 */ -(void)setupRefresh { //1.添加刷新控件 UIRefreshControl *control=[[UIRefreshControl alloc]init]; control.attributedTitle = [[NSAttributedString alloc] initWithString:@"努力加载中……"]; control.tintColor = [UIColor grayColor]; [control addTarget:self action:@selector(refreshStateChange:) forControlEvents:UIControlEventValueChanged]; [self.tableView addSubview:control]; //2.马上进入刷新状态,并不会触发UIControlEventValueChanged事件 [control beginRefreshing]; // 3.加载数据 [self refreshStateChange:control]; } /** * UIRefreshControl进入刷新状态:加载最新的数据 */ -(void)refreshStateChange:(UIRefreshControl *)control { NSLog(@"刷新了"); [control endRefreshing]; } @end
效果图
标签:
原文地址:http://www.cnblogs.com/LetterV/p/5591573.html