简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM