菜鸟教程小白 发表于 2022-12-12 17:09:17

ios - 使用容器 View Controller 和 Storyboard 构建滑出式菜单。我很困惑


                                            <p><p>我有兴趣为 ViewController 构建一个滑出侧边栏,并且我已经阅读了大量关于如何实现它的文章。 <a href="http://www.raywenderlich.com/32054/how-to-create-a-slide-out-navigation-like-facebook-and-path" rel="noreferrer noopener nofollow">This tutorial</a> ,以及几乎所有其他人都在创建 subviewController ,这似乎是一个很好的方法。但是,它总是在示例代码中完成。</p>

<p> <a href="http://sandmoose.com/post/35714028270/storyboards-with-custom-container-view-controllers" rel="noreferrer noopener nofollow">This post</a>讨论了如何在 Storyboard 中创建容器 ViewController ,但它让我感到困惑容器 View 在 Storyboard 中究竟是如何工作的,而且似乎在线解释的方式很少。</p>

<p>最后,<a href="http://thelongestblogurlicouldthinkof.blogspot.ca/2013/03/problem-i-needed-menu-that-slides-from.html" rel="noreferrer noopener nofollow">this post</a>讨论了如何使用容器 ViewController 和 Storyboard 实现滑出菜单。听起来很完美吧?好吧,在阅读它时,我很困惑作者似乎如何使用多个容器 View 。我认为应该有一个包含所有 subviewController 的<em>一个</em>。在那篇文章中正确实现了吗?</p>

<p>基本上,我很想解释一下如何通过 Storyboard 使用容器 ViewController 来实现多个 ViewController 。我从第一个教程中了解到,您拥有包含所有内容的 ViewController ,然后将 ViewController 添加到该容器,然后它们都通过委托(delegate)一起工作。在 Storyboards 中实现这一点让我摸不着头脑。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>添加容器基本上是将 subviewController 及其 View 添加到主 Controller 。我认为您在这里不清楚两件事。首先,每个容器只能链接到 1 个 Controller / View 对。所以,如果你想拥有多个子 Controller ,你必须拥有多个容器。其次,父子 Controller 之间的通信由“embed segues”处理,而不是委托(delegate)。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 使用容器 ViewController 和 Storyboard 构建滑出式菜单。我很困惑,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/20533700/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/20533700/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 使用容器 View Controller 和 Storyboard 构建滑出式菜单。我很困惑