I would like to embed a UISegmentedControl
somewhere in my UINavigationController
s topbar.
It is no problem embedding it in a UIBarButtonItem
and setting it as the left or right barButtonItem.
I can understand this approach when dealing with the screen real-estate of an iPhone. I am, however, doing this in a Popover on an iPad and there is "lots" of vertical space available in the topbar. If I add the segmentedControl as a left or right barButtonItem it gets scaled down so that I can not see the text on my segment button, it gets to be the width of a "Done" button etc. If I try to add it to the navigationItem TitleView it will show up all the way to the right and still scaled down more than my 3 segment control with text can display.
How would I go about adding a UISegmentedControl
to the center of the UINavigationController
that wraps my popovers content.
Hope someone can help me out:) thanks in advance.
Why would you need to put the control in the popover title bar? iPad has much more screen real estate to consider putting it into the view below.
-- EDIT --
I tried it myself and it works. Here is the code setting up the popover controller:
Here is the implementation of TestController:
Here is the result:
There are no tricks in my code besides sending
sizeToFit
to the segmented control. Does this work for you?