IOS UITableView 上滑 下拉刷新 可以处理加载数据事件
通过UIScrollView控件的事件来判断是上拉还是下拉刷新,然后做响应的操作
- (void)scrollViewDidScroll:(UIScrollView
*)scrollView{
//康海涛测试Ok的
CGPoint offset1 = scrollView.contentOffset;
CGRect bounds1 = scrollView.bounds;
CGSize size1 = scrollView.contentSize;
UIEdgeInsets inset1 = scrollView.contentInset;
float y1 = offset1.y + bounds1.size.height - inset1.bottom;
float h1 = size1.height;
if (y1 > tableViewController.frame.size.height)
{
flagShuaxin = YES;
}
else if (y1 < tableViewController.frame.size.height)
{
flagShuaxin = NO;
}
else if (y1 == tableViewController.frame.size.height) {
DLog(@"%@", flagShuaxin ? @"上拉刷新" : @"下拉刷新");
}
}