当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - iOS Navigation Bar Title View Buttons

问题描述:

In iOS 7+, how would one go about setting the navigation bar title view to be a stack of actions that trigger sorting a mutable array within the view controller?

For instance:

Yik Yak's Navigation Bar

http://i.stack.imgur.com/PcJNM.jpg

网友答案:

You can set the navigation bar title to be a UIView with self.navigationItem.titleView. For example:

UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"New", @"Hot"]];
[segmentedControl sizeToFit];
// Configure your segmentedControl to your liking...

self.navigationItem.titleView = segmentedControl;

Also, can take a look at this one: UINavigationBar with buttons as title. Basically, you can customize the titleView as much as you want.

分享给朋友:
您可能感兴趣的文章:
随机阅读: