NSTableView与加号和减号按钮 [英] NSTableView with Plus and Minus buttons

查看:171
本文介绍了NSTableView与加号和减号按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何做这样的事?





在Interface Builder库中没有找到任何适当的对象。



任何想法?

解决方案

我发现的最好的方法是使用NSSegmentedControl。



 样式:小方形
模式:选择瞬间

看起来更好。现在,使用image字段设置 NSAddTemplate NSRemoveTemplate



好,我们有 + - 空段。要防止用户选择最新的一个,请从细分:弹出窗口中选择,然后关闭启用复选框(位于状态: strong> label)。



最后,我们要做的是设置前两段的 width >


  1. 转到尺寸检查器

  2. 选择段0

  3. 关闭修复复选框(片段应立即自动调整大小以适合图片)

  4. 1 并重复3号。
  5. 现在,当您调整控件大小时,只有上一个细分会改变宽度。


  6. 享受;)


    How can I do something like that?

    I didn't find any appropriate object in the Interface Builder library.

    Any thoughts?

    解决方案

    The best way that i found is to use NSSegmentedControl.

    after you dragged it on the canvas, you should configure its style:

    Style: Small Square
    Mode:  Select Momentary
    

    looks better. Now use "image" field to set NSAddTemplate and NSRemoveTemplate. Make sure that label field is empty.

    Ok, we have "+", "-" and one empty segment. To prevent the latest one to be selected by the user, select it from Segment: pop up and turn off Enabled check box (located next to State: label).

    And lastly, what we have to do is set width of first two segments to make them square.

    1. Go to Size inspector
    2. Select Segment 0
    3. Turn off "Fixed" checkbox (segment should immediately autoresize to fit image)
    4. Select Segment 1 and repeat number 3
    5. Now as you resize control, only last segment will change width
    6. Put it at the bottom of your table view and resize as well.

    Enjoy ;)

    这篇关于NSTableView与加号和减号按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆