如何在许多视图中显示相同的导航栏? [英] How do I display the same navigation bar throughout many views?

查看:172
本文介绍了如何在许多视图中显示相同的导航栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以为一个视图重现以下导航栏:

I can reproduce the following navigation bar for one view:

然而,一旦我点击按钮后移动到下一个视图,我会丢失最右边的两个图标(搜索,个人资料) 。我知道从故事板设置导航项通常是每个视图。我可以为每个视图复制这些项目,但我想知道是否有更好的方法来执行一次。

However, once I move to the next view after clicking a button, I lose the top two rightmost icons(Search, Profile). I understand that setting up navigation item from a storyboard is usually per view. I can replicate those items for each view but I was wondering if there was a better way to do it once.

是否有教程解释如何维护自定义导航横跨许多视图?

Is there a tutorial that explains how to maintain a custom navigation bar across many views?

推荐答案

您需要为每个视图设置它。你应该创建一个超类并在那里实现它,所以你只需要实际编写一次代码。

You need to set it up for every view. You should probably create a superclass and implement it there, so you only need to actually write the code once.

这篇关于如何在许多视图中显示相同的导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆