NSTableView with Plus and Minus buttons

后端 未结 4 1887
情书的邮戳
情书的邮戳 2020-12-01 05:37

How can I do something like that?

\"Screenshot\"

I didn\'t find any appropriate object in the Interface

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 06:12

    Update for OSX Yosemite

    I tried to achieve the same look as Mail.app has in the Accounts view (right window on my screenshot).

    I did achieve the desired result by following the steps below:

    1. Add a NSSegmentedControl
    2. Add two segments and set the image to each:
      • NSAddTemplate for the + button
      • NSRemoveTemplate for the - button
    3. Set the size of the segments to fixed and set the value to 32 pixels
    4. The rectangle next to the buttons is a NSButton with the style Gradient.
    5. The Button is enabled but Refuses First Responder is set to true so that it is not clickable.

    Screenshot

提交回复
热议问题