UINavigationBar Touch

前端 未结 9 1291
北恋
北恋 2020-12-23 17:53

I would like to fire an event on touch when a user taps the title of the navigation bar of one of my views.

I\'m at a bit of a loss on whether I can access the view

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 18:11

    The UINavigationItem class reference has a titleView property, which you can set to your custom UIView.

    In other words, make a subclass of UIView with your touch handlers, and then when you push your navigation item, set that item's titleView property to an instance of your subclass.

提交回复
热议问题