带有加号和减号按钮的 NSTableView [英] NSTableView with Plus and Minus buttons

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

问题描述

我怎么能做这样的事情?

How can I do something like that?

我在 Interface Builder 库中没有找到任何合适的对象.

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

有什么想法吗?

推荐答案

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

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

看起来更好.现在使用图像"字段设置NSAddTemplateNSRemoveTemplate.确保标签字段为空.

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

好的,我们有+"、-"和一个空段.要防止用户选择最新的一个,请从 Segment: 弹出并关闭 Enabled 复选框(位于 State: 旁边)中选择它强>标签).

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. 转到尺寸检查器
  2. 选择段 0
  3. 关闭固定"复选框(段应立即自动调整大小以适合图像)
  4. 选择段 1 并重复编号 3
  5. 现在当你调整控件大小时,只有最后一段会改变宽度
  6. 将它放在表格视图的底部并调整大小.
  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.

享受;)

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

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