问题描述
在我的.xib里,我在 NSView
里面放置了一个 NSColorWell
$ c> IBAction 在控制器中的 NSColorWell
的发送操作(通过文件的所有者)。我想我会回应一个点击在我的控制器和发送激活,提出 NSColorPanel
。
Inside my .xib, I've placed an NSColorWell
inside an NSView
, and connected an IBAction
in the controller to the NSColorWell
's Sent Actions (via File's Owner). I figured I would respond to a click in my controller and send activate to bring up the NSColorPanel
.
其他我的控件,我没有得到 IBAction
调用。点击调用对颜色的拖动操作。我注意到这个控件不派生自 NSActionCell
(像所有我的其他控件)。什么是正确的控件,应该用于显示一个颜色,并单击时调用 NSColorWell
?
But unlike other my controls, I'm not getting the IBAction
called. Clicking invokes a drag action on the color. I noticed this control doesn't derive from NSActionCell
(like all my other controls). What's the proper control that is supposed to be used to both display a color and invoke the NSColorWell
when clicked?
(注意:这是Xcode / IB 3.2.x)
(note: this is Xcode/IB 3.2.x)
推荐答案
您列出了 osx
和 ios
,但我猜这是一个OS X问题。
You listed both osx
and ios
in the tags, but I'm guessing this is an OS X problem.
NSColorWell的IB的Attributes Inspector中有一个Bordered复选框。这切换了一个按钮式的颜色,这是你要求的,和一个颜色,你只能拖动一个颜色色板。确保已选中,您将获得您所期望的操作。
There is a "Bordered" checkbox in IB's Attributes Inspector for NSColorWell. This toggles between a button-style color well, which is what you're asking for, and a color well which you can only drag a color swatch from. Make sure that's checked and you'll get the action like you're expecting.
这篇关于NSColorWell不发送动作点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!