使用未修饰的 UiNavigationBar
我想使用不带装饰的 UINavigationBar 。即,我想创建自己的自定义按钮,并将它们链接到与导航项链接到的相同操作(例如返回),并且顶部没有显示栏。我被告知应该使用导航栏,即使从图形上讲您应该自己设计交互。
我该怎么做呢?我对导航栏很陌生,
如果有一些教程你可以指导我,那就太好了(即使用不带装饰的导航栏)。
提前致谢!
问候, 尼克拉斯
I would like to use UINavigationBar without decoration. I.e. I would like to create my own custom buttons and link those to the same actions (e.g. back) as the navigation items were linked to and have no bar presented at the top. I was told that one should use navigation bar even though graphically you should design the interaction yourself.
How do I go about doing this? I am quite new to navigation bar to start with...
If there is some tutorial you can direct me to it would be great (that is for using nav-bar without decoration).
Thanks in advance!
Regards,
Niklas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用子视图控制器隐藏导航栏,
然后只需在子视图控制器上的任意位置添加您自己的按钮即可。要返回,只需使用
但是,这种方法确实要求您在每个子视图控制器上都有按钮,而不是仅在导航控制器中拥有一次按钮。您可以在导航控制器的视图中添加一个子视图来遮盖导航控制器。还有其他选项,但它们可能没有那么有用。
You can hide the navigation bar from a subview controller with
Then just add your own buttons wherever you want on your subview controllers. To go back, just use
However, this approach does require that you have the buttons on each subview controller rather than just once in the navigation controller. You could instead add a subview in the navigation controller's view that obscures the navigation controller instead. There are other options as well, but they are probably not as useful.
您可以使用 UINavigationController 来管理视图堆栈,但隐藏导航栏并构建自定义 UI 来替换它。然后调用相应的push/pop方法来调出不同的视图。
You can use an UINavigationController to manage the stack of views, but hide the navigation bar and build your custom UI to replace it. Then call the corresponding push/pop methods to bring up the different views.