IOS6新特性 UIRefreshControl下拉刷新

  UIRefreshControl 是IOS6 引入的新API, 苹果估计想取代第三方的pull to refresh。

  在iOS6中UITableViewController 已经集成了UIRefreshControl 控件。UIRefreshControl目前只能用于UITableViewController

  初始化:

  

1 self.refreshControl = [[UIRefreshControl alloc]init];
2     //    self.refreshControl.tintColor = [UIColor blueColor];
3     self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];
4     [self.refreshControl addTarget:self action:@selector(handleData) forControlEvents:UIControlEventValueChanged];

  刷新数据:

1 - (void) handleData
2 {
3     NSLog(@"refreshed");
4     [self.refreshControl endRefreshing];
5     self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];
6  
7     self.count++;
8     [self.tableView reloadData];
9 }

你可能感兴趣的:(ios,下拉刷新,6)