Search code examples
objective-ccocoanssegmentedcontrol

NSSegmentedControl within tool bar like Xcode 4


I would like to implement a NSSegmentedControl like those in the XCode 4 toolbar (View or Editor). I don't manage to adjust an image within it and I can not set up the frame using Interface Builder. What is the best strategy to follow ?


Solution

  • To me the cells of Xcode's segmented controls look like stock AppKit segments.
    To achieve that appearance, choose Capsule for the Style setting and Select Any for Mode (to get multiple selection).

    The emboss effect for the images is automatically applied to all black images whose name ends with "Template". In the attached screenshot I used some stock template images (e.g. NSFlowViewTemplate) from Interface Builder.

    Xcode style segmented control

    Update
    Regarding frame size: NSSegmentedControls have a fixed height (3 control size settings: Regular, Small & Mini) and variable widths (per segment).