I wonder if this can be achieved using Storyboard IB:
self.navigationItem.leftBarButtonItems = @[barButton1, barButton2]
EDITED:
The purpose is to preserve the benefits of using storyboard and if it's possible without using any lines of code.
EDIT #2:
Based on this answer I experimented and saw that it is possible to link the Title View property of the Navigation Item to a Toolbar
but it looks to me like a hack (and I might want to preserve the Title as well):
Any better idea?
Go to the Storyboard. Select the View Controller and in The Editor menu select Embed in -> Navigation Controller. Next, drag a Bar Button from the Object Library to the left side of the Navigation Bar and name it "Left Item". Repeat this for the right side and name it "Right Item".
There a way to add a view to navigationItem. Than add buttons or labels you need to the view.
Can use below code :
UIBarButtonItem *btnShare = [[UIBarButtonItem alloc] initWithCustomView:self.backbtn]; UIBarButtonItem *btnRefresh = [[UIBarButtonItem alloc] initWithCustomView:self.testbutton2]; [self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:btnShare,btnRefresh, nil]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With