Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding segment controller on navigation bar in the second row

I want to add a segment controller to the navigation bar not as the title, but like this: enter image description here

How can I do that?

like image 923
Eli_Rozen Avatar asked Aug 15 '13 01:08

Eli_Rozen


1 Answers

The problem is that it looks like this uses the navigation bar's title, which is actually in the same place as where you want your segmented control to go. Instead, you need to add a "prompt" to the navigation bar to increase the height of the bar, and add the prompt text above the content area of the bar.

This can be done purely in Interface Builder as illustrated by the screenshot below, or programmatically using the following code:

[self.navigationController.navigationItem setPrompt:@"some prompt text"];

enter image description here

like image 142
Mick MacCallum Avatar answered Nov 08 '22 14:11

Mick MacCallum