• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

iphone - 无法摆脱 UITableView 的 tableFooterView 中的颜色

[复制链接]
菜鸟教程小白 发表于 2022-12-12 13:45:42 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我有一个包含三个部分的标准 UITableView。在表格的底部,我尝试添加一个 tableFooterView。似乎表格中的最后一行和 tableFooterView 的顶部之间有一个标准间距,这很好,但我的问题是这个间距中有不同的颜色,我不能不要摆脱。我需要那个间距来匹配我的 tableView 的背景。

这里有一些代码:

self.menuTable.backgroundColor = [UIColor redColor];
self.menuTable.backgroundView = nil;
self.menuTable.separatorColor = [UIColor clearColor];
self.menuTable.delegate = self;
self.menuTable.sectionHeaderHeight = 10.0;

UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
footer.backgroundColor = self.menuTable.backgroundColor;
UILabel *footerLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, 205, 100)];
footerLabel.text = @"foo bar.";
footerLabel.textColor = [UIColor blackColor];
footerLabel.backgroundColor = self.menuTable.backgroundColor;
footerLabel.numberOfLines = 10;
footerLabel.font = [UIFont italicSystemFontOfSize:11.0];
[footerLabel sizeToFit];

[footer addSubview:footerLabel];
self.menuTable.tableFooterView = footer;

这是一个屏幕截图(对于红色感到抱歉,但这是查看颜色差异的最简单方法)。

enter image description here



Best Answer-推荐答案


哎呀。早些时候我试图添加一个 sectionFooterView,并实现了 tableView:heightForFooterInSection:,最后一个部分返回 20。这就是那个间隙的来源,它的默认颜色是白色。由于我现在将文本放置为 tableFooterView,因此我刚刚删除了该委托(delegate)回调,一切都按预期呈现。

关于iphone - 无法摆脱 UITableView 的 tableFooterView 中的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18365044/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap