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

ios - 我们可以在 iOS 中同时向一个窗口添加多个 subview 吗?


                                            <p><p>是否可以向给定窗口添加超过 1 个 subview 。例如。 <code> </code> 其中一个 View 是 UIViewController。
我试过这样做,但 UIViewControllerView 会覆盖另一个 subview 。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>确保两个 View 的大小不同,因此它们不会相互重叠。尝试将一个 View 的 x 和 y 位置以及背景颜色更改为与另一个 View 不同的颜色,以了解我的意思。</p>

<p>快速浏览<a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html" rel="noreferrer noopener nofollow">UIWindow</a>文档会显示它继承自 UIView,您可以向其中添加任意数量的 subview 。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 我们可以在 iOS 中同时向一个窗口添加多个 subview 吗?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/5115679/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/5115679/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 我们可以在 iOS 中同时向一个窗口添加多个 subview 吗?