ios 개발
ios objective c tableview 끝에서 data reload하기
arcjeen
2017. 8. 21. 17:07
scrollviewDelegate method를 선언해준뒤
- (void)scrollViewDidEndDragging:(UIScrollView *)aScrollView
willDecelerate:(BOOL)decelerate
{
if((int)aScrollView.tag == 1200){ // 데이터 불러올 테이블뷰 지정
}else{
CGPoint offset = aScrollView.contentOffset;
CGRect bounds = aScrollView.bounds;
CGSize size = aScrollView.contentSize;
UIEdgeInsets inset = aScrollView.contentInset;
float y = offset.y + bounds.size.height - inset.bottom;
float h = size.height;
float reload_distance = 50;
if(y > h + reload_distance) {
NSLog(@"load more rows");
}
}
}