How can I add a middle button in a UINavigationController?
I have a UINavigationController that has its left and right button properties set. Instead of having the title in the middle, I want to put a button there. I'm not sure how I can achieve this.
CODE:
UIBarButtonItem* titleButton = [[UIBarButtonItem alloc]
in开发者_运维问答itWithTitle:symbol
style:UIBarButtonItemStyleBordered
target:self
action:@selector(addToWatchlistButtonClicked:)];
self.navigationItem.titleView = titleButton;
Use titleView property of UINavigationItem.
self.navigationItem.titleView = button;
精彩评论