检测并处理或覆盖导航栏上的单击 [英] Detect and handle, or override, clicks on a navigation bar

查看:99
本文介绍了检测并处理或覆盖导航栏上的单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中已将两个项目推到导航栏上.最上面的项目(以后退"按钮结束)应该具有跳回到起始页(即网络新闻列表)的功能.另一个仅显示徽标.老板希望导航栏的外观和感觉简单但功能简单,因此用户可以在新闻站点周围单击,但始终能够一键跳到新闻列表页面.

I have an app where I've pushed two items onto the navigation bar. The top item, which ends up as a 'back' button, should have the function to jump all the way back to the start page, which is a list of web news. The other one simply displays a logo. The boss wants a navigation bar look and feel but with a simple function, so the user can click around the news site, but always be able to jump to the news list page with just the one click.

在IB中用两个项目创建固定导航栏的唯一选择是我可以将插座连接到可点击项目吗?或者是否可以通过某种方式拦截对导航栏的点击以生成requestURL? touchesBegan或touchUpInside都可以,但是到目前为止,我还没有实现它的方法.

Is the only option to create a fixed navbar with two items in IB, so that I can connect an outlet to the clickable item - or is there some way to intercept clicks to the navbar to make a requestURL? touchesBegan or touchUpInside would be fine, but I've found no way of implementing that so far.

如果整个导航栏都是可单击的,那没关系,我只需要一些提示即可实现它.可以在顶部添加一个透明的UIlabel并检测点击次数吗?

It's okay if the whole navbar is clickable, I just need some hint how to make it happen. Add a transparent UIlabel on top and detect clicks for that, maybe?

一种好处是将项目隐藏在后退"位置,而无需从堆栈中弹出.

A bonus would be to hide the item in the 'back' position without popping it from the stack.

推荐答案

不再需要答案.我认为这只是将backBarButton设置为您自己的,我发现没有办法仅更改标题和目标.关闭这个.当时我的解决方案是使其成为工具栏,可以了.

Answer not needed anymore. I think it's just setting backBarButton to your own I've found no way to just change the title and target. Closing this. My solution back then was to make it a Toolbar, worked okay.

这篇关于检测并处理或覆盖导航栏上的单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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