Vic320
Vic320

Reputation: 1105

Creating a custom view to replace UINavigationBar

I've had a lot of experience customizing UINavigationBars and find it is a royal pain in the a** to get it to do what I want without a lot of effort. So I've written my own custom UIView that behaves just like a UINavigationBar and is fully and easily customizable. However, I am having a problem, when the Navigation controller pushes a new controller onto the stack, my custom view stops receiving touch events.

To make this more clear, my app loads and displays a view controller, in the viewDidLoad method, I create and add my custom nav bar to the controller's view. A navigation controller is created programmatically and a view controller is pushed to it. At this point my custom view is on top and receiving touch events. When I push another view controller to the navigation controller's stack, my custom view is still on top and visible, but not receiving events.

So my question is how to I get my custom nav bar back into the responder chain?

Thanks for your help!

Upvotes: 1

Views: 871

Answers (1)

Sascha
Sascha

Reputation: 5973

If you don't have to support iOS < 5.0 you should try to add the UINavigationBar using UINavigationController's - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass method instead of doing it manually.

Upvotes: 1

Related Questions