菜鸟教程小白 发表于 2022-12-12 13:45:42

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


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

<p>这里有一些代码:</p>

<pre><code>self.menuTable.backgroundColor = ;
self.menuTable.backgroundView = nil;
self.menuTable.separatorColor = ;
self.menuTable.delegate = self;
self.menuTable.sectionHeaderHeight = 10.0;

UIView *footer = [ initWithFrame:CGRectMake(0, 0, 320, 200)];
footer.backgroundColor = self.menuTable.backgroundColor;
UILabel *footerLabel = [ initWithFrame:CGRectMake(60, 0, 205, 100)];
footerLabel.text = @&#34;foo bar.&#34;;
footerLabel.textColor = ;
footerLabel.backgroundColor = self.menuTable.backgroundColor;
footerLabel.numberOfLines = 10;
footerLabel.font = ;
;

;
self.menuTable.tableFooterView = footer;
</code></pre>

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

<p> <img src="/image/8oNdA.png" alt="enter image description here"/> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>哎呀。早些时候我试图添加一个 sectionFooterView,并实现了 <code>tableView:heightForFooterInSection:</code>,最后一个部分返回 20。这就是那个间隙的来源,它的默认颜色是白色。由于我现在将文本放置为 <code>tableFooterView</code>,因此我刚刚删除了该委托(delegate)回调,一切都按预期呈现。</p></p>
                                   
                                                <p style="font-size: 20px;">关于iphone - 无法摆脱 UITableView 的 tableFooterView 中的颜色,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/18365044/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/18365044/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: iphone - 无法摆脱 UITableView 的 tableFooterView 中的颜色