Detect and handle, or override, clicks on a navigation bar

为君一笑 提交于 2019-12-25 03:15:24

问题


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.

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.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/2942045/detect-and-handle-or-override-clicks-on-a-navigation-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!