I dropped a UINavigationBar onto the XIB form. Then I dropped a UIButton on the form (not on the NavigationBar). I changed the type to InfoLight (so that it looks like an Info symbol).
I then dragged the UIButton onto the UINavigationBar and set it to be the right button. It magically changes the type from UIButton to UIButtonBarItem as a result of the drag.
Why didn't I just dragged the UIButton onto the UINavigationBar to begin with? Because, once the button is there, Interface Builder won't let you change the type to InfoLight for whatever reason.
The in the adjoining .h file, I created a declaration for the IBAction
- (IBAction) btnInfoClick;
Then in the .m file, I wrote the implementation:
- (IBAction) btnInfoClick {
// kick off the about screen
// code follows
}
How do I now hook up the button on the navigation bar to my btnInfoClick function?
Or am I going about it the wrong way to begin with?
I should note that if I simply drag a button from the Library straight onto the navigation bar, I can click on the File Owner icon, and then drag the btnInfoClick IBAction onto the button. In this case, the click event fires fine.
However, in the scenario where I first drag the button elsewhere and then onto the navigation bar, the event never fires. Not sure what I am doing wrong.