How can I put an "info" button on the iPhone nav bar?

iphone

Solution

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.

Problem

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?

Original source