菜鸟教程小白 发表于 2022-12-11 16:49:30

ios - 如何使用 swift 在 subview 中添加标签栏和导航栏?


                                            <p><p> <a href="http://i.stack.imgur.com/CcoJJ.png" rel="noreferrer noopener nofollow">Please refer the image, where I have used the Navigation Bar</a>我试着到处冲浪,但找不到解决办法。另外,我是新来的,所以请帮忙!我有一个 ViewController ——登录页面,它连接到另一个 ViewController ——CoreView.swift。我在 CoreView ViewController 中创建了 5 个 subview 。我想添加一个标签栏,用户可以点击标签栏的图像,相应的 subview 应该打开。另外,帮助我将图像添加为 subview 图标。图标不显示。</p>

<p>另外,当我尝试从导航 Controller 放置后退按钮时,我可以设置标题和提示信息,但不能设置 subview 中的后退按钮,为什么会这样?</p>

<p>谢谢!</p>

<p> <a href="http://i.stack.imgur.com/q5bSV.png" rel="noreferrer noopener nofollow">Look at this image to see the code and the xib file made</a> </p>

<p>我有以下更改。但仍然没有运气..</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>关于导航栏 -> 您应该能够将 UIButton 拖放到左侧栏按钮项中:</p>

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

<p>编辑:更新图像以实际显示 xib 实现。</p>

<p>EDIT2:链接按钮使用这个:</p>

<pre><code>@IBAction func buttonTapped(sender: AnyObject) {
    print(&#34;Back button tapped&#34;)
}
</code></pre>

<p>确保将界面构建器中的按钮连接到自定义 View 。您需要有一个自定义 UIView 子类,并且应该为您的文件所有者选择。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何使用 swift 在 subview 中添加标签栏和导航栏?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/38014725/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/38014725/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何使用 swift 在 subview 中添加标签栏和导航栏?