How to add a right button to a UINavigationController?

Posted by Artilheiro on Stack Overflow See other posts from Stack Overflow or by Artilheiro
Published on 2009-08-02T20:33:41Z Indexed on 2010/05/13 5:24 UTC
Read the original article Hit count: 226

I am trying to add a refresh button to the top bar of a navigation controller with no success.

Here is the header:

@interface PropertyViewController : UINavigationController {

}

Here is how I am trying to add it:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Show" style:UIBarButtonItemStylePlain
    									  target:self action:@selector(refreshPropertyList:)];		
    	self.navigationItem.rightBarButtonItem = anotherButton;
    }
    return self;
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uinavigationcontroller