I want to put an 'i' button on the nav bar (on all the screens in which the nav bar appears). Touching on that button should bring up a view (perhaps modal) in which I can have controls. How do I put the button on the nav bar, and what how will I execute the call back?
Info Button Code:
UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[infoButton addTarget:self action:@selector(infoButtonAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *modalButton = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
[self.navigationItem setLeftBarButtonItem:modalButton animated:YES];
[modalButton release];
The code above calls method -(void)infoButtonAction. Add this to all of your ViewControllers or just create one .nib and use that for all of your views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With