UINavigationController - 两个左侧按钮加后退按钮

发布于 2025-01-04 11:24:17 字数 105 浏览 3 评论 0原文

在我看来,我的导航栏上需要有两个左侧按钮。左侧有一个自定义按钮和标准后退按钮(由导航控制器创建)。

但是,我需要使后退按钮具有正常的标准后退按钮箭头,并有一个在点击它时调用的方法。

In my view I need to have two left buttons on my nav bar. A custom button and also the standard back button (created by the nav controller) on the left.

However I need to have the back button the normal standard back button arrow and have a method which is called when tapping it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

眉目亦如画i 2025-01-11 11:24:17

我记得在《人机界面指南》中读过,苹果公司特别不鼓励这样做。除非您愿意冒应用被拒绝的风险并可能让您的用户感到困惑,否则我建议您深入研究 HIG 并了解是否可以这样做。

如果您需要它,您将必须进行自己的自定义实现,因为导航栏不支持您的要求。您需要隐藏后退按钮,然后将您自己的自定义后退按钮放置在栏上,可能是从 UIView 的子类创建的。

如果您不需要它们都是后退按钮,那么您可能会获得后退按钮的框架,并将您自己的另一个按钮放置在其右侧。

I remember reading somewhere in the Human Interface Guidelines that Apple specifically discourages this. Unless you are willing to risk app rejection and possibly confusing your users, I'd recommend you dig into the HIG and find out if you can do this or not.

If you need to have it, you will have to make your own custom implementation, as the nav bar doesn't support what your asking. You will need to hide the back button, then place your own custom back buttons on the bar, likely created from a sub-class of UIView.

If you don't need them both to be back buttons, then you might get away with getting the frame of the back button, and placing another button of your own to the right of it.

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