How to add 2 buttons into the UINavigationbar on the right side without IB?

ios, uibutton, uinavigationcontroller

Solution

With iOS 5+ it's as easy as:

UIBarButtonItem *btnShare = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(share)];
UIBarButtonItem *btnRefresh = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:btnShare, btnRefresh, nil]];

Problem

How can I add 2 buttons into the `UINavigationBar` without XIB? The 2 buttons should be aligned on the right side of the `UINavigationBar`. I know how I can add one button, but how about two?

Original source