iOS6 新特性 UIRefreshControl 下拉刷新實例

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

  在iOS6中UITableViewController 已經集成了UIRefreshControl 控件。UIRefreshControl目前只能用於UITableViewController code

  初始化: get

  

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

  刷新數據: it

- (void) handleData
{
    NSLog(@"refreshed");
    [self.refreshControl endRefreshing];
    self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];

    self.count++;
    [self.tableView reloadData];
}
相關文章
相關標籤/搜索