Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding segmented control with in the Navigation Bar

can anybody help with the code on how to add segmented control within the navigation bar....i have seen it on some applications and want to implement it

thanks

like image 813
Gani Avatar asked Nov 05 '09 11:11

Gani


People also ask

What is segment control?

A segmented control is a linear set of two or more segments, each of which functions as a button. Within a segmented control, all segments are usually equal in width. Like buttons, segments can contain text or images.

How do you change view controllers using segmented control?

To switch between the child view controllers, we use a segmented control. Click the + button in the top right to bring up the Library and add a segmented control to the navigation bar of the master view controller. Open MasterViewController. swift and create an outlet for the segmented control.


1 Answers

Do you want to use Interface Builder or do it in code only?

With IB operation is very straightforward, you only need to drag segmented control to place on navigation bar where title is located. Title will be replaced by the segmented control.

If you want to accomplish this in code, please refer to this section of iPhone reference library. It seems you need to set navigation item's titleView property to your segmented control, which is subclass of UIView, so this is completely legal.

like image 79
madej Avatar answered Sep 18 '22 17:09

madej