Pagination isn't working after I added a searc

2019-09-05 12:55发布

问题:

I have an issue. I am using the parse framework and I need to add a search bar for my PFQueryTableViewController. I need to rewrite the below methods "number of sections", "number of rows in section" as well as "cell for row at index path".

After rewriting the above methods I'm finding that even through I enabled the pagination function, the "load more" label doesn't appear. Only the first 10(I set 10 per page) records are displayed. I think you should have some logic to fetch the total record count if it is bigger than 10, then the load more will appears. So which method should I rewrite so that the pagination works?

回答1:

If you over ride the number of rows in section methods you have to call super.

In my code i faced this issue. I solved by put the code follows

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    int rowCount = [super tableView:tableView numberOfRowsInSection:section];
    if (self.isEditing) {
        rowCount++;
    }
    return rowCount;
}