UIRefreshControl

UIRefreshControl

刷新


//下拉刷新

UIRefreshControl *refresh = [[UIRefreshControl alloc] init];

//设置文本标题
refresh.attributedTitle= [[NSAttributedString alloc] initWithString:@"下拉刷新"];

//绑定方法.ValueChanged
[refresh addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];

[self.view addSubview:refresh];

//实现方法
- (void)refresh:(UIRefreshControl*)refresh {
refresh.attributedTitle= [[NSAttributedString alloc]initWithString:@"正在刷新"];

// 设置动画时间 及结束时调用的方法
[self performSelector:@selector(refreshTruly:) withObject:refresh afterDelay:3];
}

- (void)refreshTruly:(UIRefreshControl*)refresh {

refresh.attributedTitle= [[NSAttributedStringalloc]initWithString:@"完成刷新"];

//完成刷新
[refresh endRefreshing];
}

你可能感兴趣的:(UIRefreshControl)