一般上拉加載數(shù)據(jù)都是上拉以后在請(qǐng)求,最為一個(gè)輕微強(qiáng)迫癥患者覺得不爽,發(fā)現(xiàn)網(wǎng)易新聞就是一邊上拉一邊加載,就想著試一下勋锤。
開始想用scrollView的代理 發(fā)現(xiàn)不怎么好用 后來查了下tableView的一個(gè)代理方法也能做到,
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
//獲取當(dāng)前行數(shù)
NSInteger row = [indexPath row];
//判斷下當(dāng)前行數(shù)和當(dāng)前總數(shù)據(jù)數(shù) -1 代表想在倒數(shù)第幾行開始請(qǐng)求
if (row == _dataListArray.count - 1) {
//請(qǐng)求上拉數(shù)據(jù)
if (!_isLastData) {
[self.tableView.footer beginRefreshing];
}
}
}
謝謝這位的博客:http://blog.csdn.net/xiaobo16/article/details/38511221