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

ios - UITableView/UICollectionView 上的 UIRefreshControl 大小错误


                                            <p><p>我正在尝试使用具有彩色背景的 <code>UIRefreshControl</code>。当您在 <code>UITableView</code> 或 <code>UICollectionView</code> 上使用 <code>UIRefreshControl</code> 时,我发现它的大小实际上是不准确的。</p>

<p>为了突出显示这一点,我为 <code>UIRefreshControl</code> 和单元格设置了背景颜色。</p>

<p>我该如何弥补这个差距?这让我发疯了。它看起来很不专业,似乎被使用白色 <code>UIRefreshControl</code>s 的人隐藏了。</p>

<p>这里 <code>UIRefreshControl</code> 与 <code>UITableView</code> 齐平
<a href="/image/qoU9i.png" rel="noreferrer noopener nofollow"><img src="/image/qoU9i.png" alt="Resting position"/></a> </p>

<p>现在我们开始看到一点差距</p>

<p> <a href="/image/O4vuU.png" rel="noreferrer noopener nofollow"><img src="/image/O4vuU.png" alt="enter image description here"/></a> </p>

<p>现在差距更大了</p>

<p> <a href="/image/NcPCQ.png" rel="noreferrer noopener nofollow"><img src="/image/NcPCQ.png" alt="enter image description here"/></a> </p>

<p>要重现这一点,只需使用带有 UITableViewController 的普通 Storyboard。</p>

<p>相关代码:</p>

<pre><code>self.refreshControl = [ init];
];
self.refreshControl.tintColor = ;
</code></pre>

<p> repo 代码:
<a href="https://github.com/Lyricalpanda/RefreshControl/tree/master/RefreshControl" rel="noreferrer noopener nofollow">https://github.com/Lyricalpanda/RefreshControl/tree/master/RefreshControl</a> </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>好吧,在您的示例应用程序中,我可以通过以下方式消除空白:</p>

<pre><code>self.view.backgroundColor = ;
</code></pre>

<p>但如果这是可以接受的,您根本不需要设置刷新控件的背景颜色,只需设置 View 的背景颜色。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UITableView/UICollectionView 上的 UIRefreshControl 大小错误,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/34032173/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/34032173/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UITableView/UICollectionView 上的 UIRefreshControl 大小错误