开发者

How can I add a middle button in a UINavigationController?

开发者 https://www.devze.com 2023-03-30 04:03 出处:网络
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.

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消