This is how you programmatically add a button like UIBarButtonItem to the center of Navigation Bar:
UISegmentedControl *button = [[UISegmentedControl alloc]\\
initWithItems:[NSArray arrayWithObjects:\\
LS(@"Folders"), nil]];
button.frame = CGRectMake(0, 0, 100, 30);
button.center = self.view.center;
button.momentary = YES;
button.segmentedControlStyle = UISegmentedControlStyleBar;
button.tintColor = UIColorFromRGB(0x0000DD);
[button addTarget:self action:\\
@selector(foldersClicked) forControlEvents:\\
UIControlEventValueChanged];
self.navigationItem.titleView = button;