I’m developing a small application. I need to create three buttons in a subclass. One button is add, another one is search and the last one is back. I also create left and right buttons. But I can’t create search button in the center of the navigation bar. How can I create it? My code is:
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle:@"Flip"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(flipView)];
self.navigationItem.rightBarButtonItem = flipButton;
[flipButton release];
UIBarButtonItem *flipButtons = [[UIBarButtonItem alloc]
initWithTitle:@"Add"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(addbuttonview)];
self.navigationItem.leftBarButtonItem = flipButtons;
[flipButtons release];
}
How to create a middle button in the navigation bar? Please help me.
Below is the code to use segment control in navigation bar programatically