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

ios - 背景颜色(colorWithPatternImage)没有填充 iPad 的整个 View


                                            <p><p>我正在尝试使用我拥有的方格图像设置背景颜色。我目前在我的 iPhone 应用程序中使用它,现在正在尝试创建一个通用应用程序。当我使用这个时:</p>

<pre><code> UIImage *bgimg = ;
self.view.backgroundColor = ;
</code></pre>

<p>它适用于我的 iPhone 应用程序。当它在 iPad 上以纵向模式加载时,底部有大约 20 像素的空白区域。当它以横向加载时,它很好。如果我从纵向旋转到横向,然后再旋转回来,也可以。 </p>

<p>我缺少什么会一直填充模式直到我的 View 底部?</p>

<p><strong>更新</strong></p>

<p>如果我将颜色设置为纯色 [​​UIColor blueColor],则整个屏幕将正确填充。那么为什么 colorWithPatternImage 和纯色会有差异呢?</p>

<p><strong>更新 2</strong></p>

<p>我使用的文件是一个尺寸为 252x230 的 PNG 文件。我已使用此图像在此应用程序的 iPhone 版本中制作图案,没有任何问题。我不确定文件大小或尺寸是否对这个问题有任何影响,但我想我会把它放在那里以防万一。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>也许 View 没有设置为正确的高度。如果将 backgroundColor 更改为纯色,它会填满整个屏幕吗?</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 背景颜色(colorWithPatternImage)没有填充 iPad 的整个 View ,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/8651276/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/8651276/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 背景颜色(colorWithPatternImage)没有填充 iPad 的整个 View