Search code examples
iphoneuinavigationbaruinavigationitemuicontrol

iPhone - Separated UINavigation Bar Items


alt text

Is there an existing API for this kind of separated controls for the UINavigationbar seen in Mail.app? More specifically this up and down arrows shown in the picture.


Solution

  • Note that you can create UIBarButtonItem with any custom view you want. So you can create it with UISegmentedControl as well - it is what's likely used in your example. Workflow should be something like:

    1. Create momentary (momentary property set to yes) UISegmentedControl with 2 segments
    2. Assign an image to each of them (using setImage:forSegmentAtIndex: method). Then
    3. Create UIBarButtonItem initialized with this UISegmentedControl as a custom view (using initWithCustomView: method).
    4. Add your UIBarButtonItem as a left or right BarButtonItem to the UINavigationItem