菜鸟教程小白 发表于 2022-12-12 23:54:40

ios - 带有导航 Controller 的不同页面上的 Xamarin.SideBar


                                            <p><p>所以我使用 <a href="https://components.xamarin.com/view/SidebarNavigation" rel="noreferrer noopener nofollow"><strong>this(Xamarin.SideBar)</strong></a>我项目中的组件。<br/>
我需要在所有主页上都有 <strong>SideMenu</strong> 的最大问题(表示为选项卡,每个都有一个导航 Controller ,请参见图片)。 </p>

<p>所以我的页面在屏幕上看起来像:
<a href="/image/0YrJe.jpg" rel="noreferrer noopener nofollow"><img src="/image/0YrJe.jpg" alt="enter image description here"/></a> <br/>
其中 <strong><em>A,B,C,D,E,G</em></strong> 是标签页,其中包含一个导航 Controller 。(绿色圆圈表示现在位于页面 <strong>< em>A</em></strong>)</p>

<p>现在我要打开我的 <strong><em>SideBar</em></strong><br/>
<a href="/image/FMMDj.jpg" rel="noreferrer noopener nofollow"><img src="/image/FMMDj.jpg" alt="enter image description here"/></a>
打开菜单并单击第一个按钮,bam,我们在另一个 <strong><em>ViewController</em></strong> 上,其中包含 <strong><em>Navigation stack</em></strong>按钮 <strong><em>Back</em></strong> 到 <strong><em>ViewController</em></strong>(页面)调用了 <strong><em>A</em></strong>(选项卡中的其他页面相同)。 </p>

<hr/>

<p>我的 Storyboard看起来像:</p>

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

<p>我很困惑如何实现我的目标!? </p>

<p>似乎我需要制作一个 <strong><em>BaseController</em></strong> 来创建 <strong><em>ONEs</em></strong> 这个 <strong><em> <strong><em>SideBar</em></strong> 的 MenuController</em></strong> ,但是 Xamarin.SideBar 组件的架构让我害怕,因为我每次都需要放置一个 <strong><em>NavController </em></strong> 和 <strong><em>ContentArea</em></strong>...</p>

<p>有什么建议吗?谢谢!</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>首先,不要使用 Xamarin 组件,而是使用更新较多的 nuget 包。 <a href="https://www.nuget.org/packages/SidebarNavigation/" rel="noreferrer noopener nofollow">Here</a>链接。不用担心它是同一个库,他们似乎不会更新组件,但是当你有一个 nuget 时谁需要一个组件!</p>

<p>关于您的问题,是的,您是对的,您需要创建一个 BaseViewController 来保存侧边菜单。您的主要 Controller (A、B、C、D、E、F、G)都将由此派生,因此您不必重复代码。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 带有导航 Controller 的不同页面上的 Xamarin.SideBar,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/42354883/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/42354883/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 带有导航 Controller 的不同页面上的 Xamarin.SideBar