UITableViewController自带下拉刷新空间-UI

2016-11-01  本文已影响64人  酱油之神

延伸:我们开发过工程中,使用MJRefresh的刷新空间最多,其实UITableViewController有一个自带的下来刷新控件,但使用的人不多。


创建:

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

相关方法:

-(void)change:(UIRefreshControl*)con{
    self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"开始刷新了~~"];
}

[self.refreshControl endRefreshing];
[self.refreshControl beginRefreshing];

上一篇 下一篇

猜你喜欢

热点阅读