1

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 ?

yageek
  • 4,115
  • 3
  • 30
  • 48

1 Answers1

1

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).

Thomas Zoechling
  • 34,177
  • 3
  • 81
  • 112
  • Thanks for the precision. I already setted up those settings. The problem is that I do not manage to adjust the height with Interface Builder. Do you know how I can set up the height of the whole control segment ? – yageek Jun 11 '13 at 15:20
  • Height is fixed - You can only influence it via the controls size setting. Updated my answer. – Thomas Zoechling Jun 11 '13 at 15:36
  • Thank you for yours precisions :) Maybe two more questions : – yageek Jun 11 '13 at 16:05
  • First : are image from Xcode segmented control availbles ? Second : I did not found in the documentation the information about the emboss effect that applies automatically with black images whose name ends with "Template". Could you give me some references ? – yageek Jun 11 '13 at 16:10
  • 1
    No - The Xcode images seem to be custom. The template info docs can be found in the NSImage class reference: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/Reference/Reference.html#//apple_ref/doc/constant_group/View_Type_Template_Images – Thomas Zoechling Jun 11 '13 at 16:55