I have custom buttons in the nav bar, I want to toggle their state by am confounded by their accessors.
I know to get the button of a view (slightly different code than showed below) or cell I can do this:
mybutton=(UIButton*)[cell.contentView viewWithTag:5];
How can I access the buttons of my navigation bar? (they are already set in code)
cheers
Robert
When you create the button and add it to the navbar instead of releasing the button retain it. Then you can reference them whenever you need to.
So add a property to the view controller:
@property (nonatomic, retain) UIButton *myButton;
Then in the method where you create the button use:
self.myButton = [UIButton …
Remember to release the myButton in the view controller’s dealloc method.