滚动时UITableView部分页脚重叠 [英] UITableView Section Footer overlaps when scrolling

查看:96
本文介绍了滚动时UITableView部分页脚重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UItableview,我有节目标题&页脚编程。

I have a UItableview for which i had the section header & footer programatically.

最初我遇到了在滚动上重叠的sectio标题的问题,我使用scrollViewDidScroll委托解决了

Initially i had problems with the sectio header overlapping on scroll which i solved using the scrollViewDidScroll delegate as

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    heightForHeader = 40.0;
    if (scrollView.contentOffset.y<=heightForHeader&&scrollView.contentOffset.y>=0) {
        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
    } else if (scrollView.contentOffset.y>=heightForHeader) {
        scrollView.contentInset = UIEdgeInsetsMake(-heightForHeader, 0, 0, 0);
    }
}

现在下一个问题是部分页脚是滚动时重叠。

now the next issue is with the section footer that is overlapping while scrolling.

你能帮我解决这个问题吗?

Can you help me with this?

推荐答案

您是否为页眉和页脚设置了自定义高度?

Do you set your custom heights for header and footer?

您的表视图委托应实现此方法:

Your table view delegate should implement this methods:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

应返回适当的值。

如果你返回较小的值然后你的页眉和页脚视图,那么它们可能会重叠。

If you return smaller values then your header and footer views have, then they may overlap.

这篇关于滚动时UITableView部分页脚重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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