添加搜索栏后,分页不起作用 [英] Pagination isn't working after I added a search bar

查看:81
本文介绍了添加搜索栏后,分页不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题.我正在使用解析框架,并且需要为我的PFQueryTableViewController添加搜索栏.我需要重写以下方法节数",节中的行数"以及索引路径中的行单元格".

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".

重写上述方法后,我发现即使启用了分页功能,也不会出现加载更多"标签.仅显示前10条记录(我每页设置10条).我认为您应该有一些逻辑来获取总记录数(如果它大于10),那么将会出现更多的负载.那么我应该重写哪种方法才能使分页有效?

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?

推荐答案

如果您过度使用节方法中的行数,则必须调用super.

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;
}

这篇关于添加搜索栏后,分页不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆