how to make paging(load more data like facebook) in UITableView with call api?
Code:-
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat height = scrollView.frame.size.height;
CGFloat contentYoffset = scrollView.contentOffset.y;
CGFloat distanceFromBottom = scrollView.contentSize.height - contentYoffset;
if(distanceFromBottom < height)
{
[self fetchNewsFeeds:[filteredArray count]+1 withLimit:20];
NSLog(@"end of the table");
}
}
scroll upto the content height after not call api
4
Answers
Store response data in a NSArray and then add to a NSMutableArray
//check for last index of tableview
write this code in cellForItemAtIndexPath
Take Two Sections : The rows in the first section contains items which you want to display and the second section contains one row whose cell has a
UIActivityIndicator
.Then implement the given delegate method :
Tableview Delegate when display cell this method call:
Hope your problem solve.
You need to first find last row of your tableviewcell.
Below is the code for finding last row:
You can use AFNetworking to get call your web-service.
Hope you get logic 🙂