使用未修饰的 UiNavigationBar

发布于 2024-08-25 11:08:51 字数 212 浏览 4 评论 0原文

我想使用不带装饰的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧城空念 2024-09-01 11:08:51

您可以使用子视图控制器隐藏导航栏,

[self.navigationController setNavigationBarHidden:YES animated:NO];

然后只需在子视图控制器上的任意位置添加您自己的按钮即可。要返回,只需使用

[self.navigationController popViewControllerAnimated:YES];

但是,这种方法确实要求您在每个子视图控制器上都有按钮,而不是仅在导航控制器中拥有一次按钮。您可以在导航控制器的视图中添加一个子视图来遮盖导航控制器。还有其他选项,但它们可能没有那么有用。

You can hide the navigation bar from a subview controller with

[self.navigationController setNavigationBarHidden:YES animated:NO];

Then just add your own buttons wherever you want on your subview controllers. To go back, just use

[self.navigationController popViewControllerAnimated:YES];

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.

羁拥 2024-09-01 11:08:51

您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文