无法CTRL +将NSButton拖动到自定义NSView标头 [英] Can't CTRL+Drag NSButton to custom NSView header
问题描述
我想创建一个由Interface Builder实例化的自定义 NSTableCellView
。我已将Table Cell View类设置为 MyTableCellView
,并正确创建 MyTableCellView:NSTableCellView
.m / .h文件。
I'd like to create a custom NSTableCellView
instantiated by Interface Builder. I've set my Table Cell View class to MyTableCellView
, and properly created MyTableCellView : NSTableCellView
.m/.h files.
但是,我不能按CTRL +从这个视图里面拖一个简单的按钮到 MyTableCellView.h
为了创建一个 IBOutlet
。
However, I just can't CTRL+Drag a simple button from inside this view to MyTableCellView.h
in order to create an IBOutlet
.
这是一个显示发生了什么的视频: http://youtu.be/sNNbuVT-SZs 。
Here is a video to show what happens: http://youtu.be/sNNbuVT-SZs.
视图如何分类:
我如何尝试CTRL +拖动按钮
此外,有时候,Interface Builder只是不允许修改单元格视图的类。发生了什么事?
Also, sometimes, Interface Builder just don't allow the cell view's class to be modified. What's happening ?
推荐答案
我终于找到了一个解决方案,这有点奇怪,但按预期工作。我没有直接将 NSButton
连接到 MyTableCellView
标题,而是使用了反向路径:
I finally found a solution, that is a little weird but works as expected. Instead of connecting the NSButton
to MyTableCellView
header directly, I used the reversed path:
手动创建插座:
@property(retain, nonatomic) IBOutlet NSButton* button;
然后点击左边的空白圆圈,然后将其拖到你的XIB文件按钮:
Then click the empty circle on the left, and drag it to your XIB file's button:
我不知道为什么会这样,如果你知道这个问题,请告诉我。
I have no idea why it works this way, please let me know if you know the anwser.
这篇关于无法CTRL +将NSButton拖动到自定义NSView标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!