How to add a button to UINavigationBar programmatically?
The example below will display a button with a title "Contact" on the navigation bar on the right. Its action calls a method named "contact" from the viewcontroller. Without this line the right button is not visible.
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Contact"
style:UIBarButtonItemStylePlain target:self action:@selector(contact:)];;
