I implemented search Api and its working fine in ios objective c. I am getting result from server. And again I need to call the same service when I am scroll end on tableview. And I need to pass extra parameter as "page=2" at same time on same page. And I need to show next page data on table view end.
Asked
Active
Viewed 132 times
1 Answers
-1
This is pagination concept.
Please go through this link and you will get a better idea about it : Swift tableView Pagination
I can show what I have done in my project :
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row = arrayDataForTable.count && page <= totalNumberOfPages {
page += 1
}
}
In above code arrayDataForTable contains data to show in table. If user has scrolled to last cell I am adding page count increase code. I am getting "totalNumberOfPages" from api and maintaining page count as "page" locally starting from 0.
For Objective C use this method:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;

Amit
- 4,837
- 5
- 31
- 46
-
Can you please tell me in objective c, I am new to ios so. Thank you – Raviteja Aug 22 '17 at 11:16
-
@Raviteja: I have edited the answer. Try the same implementation with above mentioned delegate method. – Amit Aug 22 '17 at 11:52
-
Can you give me full code in objective c – Raviteja Aug 22 '17 at 12:46
-
Please tell me why a downvote ? – Amit Aug 22 '17 at 13:32
-
I too dont know – Raviteja Aug 22 '17 at 13:37