简体   繁体   English

用XIB连接NSToolBarItem

[英]Wiring NSToolBarItem with XIBs

For some reason I'm having a very difficult time wiring my NSToolbarItem to an IBAction. 由于某些原因,我很难将NSToolbarItem连接到IBAction。

I'm using an NSWindowController with its own XIB. 我正在使用带有自己的XIB的NSWindowController The NSToolbar is dropped into the XIB, and I added the NSToolbarItem without issue. NSToolbar被放入XIB,并且我添加了NSToolbarItem而没有任何问题。 This whole NSWindowController is created by a master NSViewController when an image is clicked. 单击图像时,整个NSWindowController由主NSViewController创建。

The problem lies with the new button not sending. 问题在于新按钮未发送。 I unchecked " Autovalidates " and checked " Selectable " so that I could actually click the button. 我取消选中“自动Autovalidates ”并选中“ Selectable ”,以便实际上可以单击按钮。

However when pressed, I receive " unrecognized selector sent to instance ". 但是,当按下时,我收到“ unrecognized selector sent to instance ”。

I've wired this several times over through the XIB interface to make sure I wasn't messing up. 我已经通过XIB界面对此进行了数次接线,以确保我不会搞砸。

What's going on? 这是怎么回事? Thank you. 谢谢。

Full error: 完整错误:

-[__NSCFType buttonPressed:]: unrecognized selector sent to instance 0x101915010

The delegate class does not know the selector you've wired. 委托类不知道您已连接的选择器。 Either your delegate is wrong or you've got a typing error in your method. 您的委托是错误的,或者您的方法中有键入错误。

Check the signature of the Method you've declared in your headerfile vs. its implementation in the class file. 检查您在头文件中声明的方法的签名及其在类文件中的实现。 Perhaps you forgot to declare a parameter. 也许您忘记了声明参数。

edit: the class type where the selector is called looked weird, so I googled __nscftype unrecognized selector . 编辑:调用选择器的类类型看起来很奇怪,所以我用__nscftype unrecognized selector搜索。 here are some suggestions, it seems like your delegate is already disposed : http://imlocation.wordpress.com/2007/09/13/strange-objects-nscftype-indicate-memory-management-bugs/ [__NSCFType searchKeyword:]: unrecognized selector sent to instance 0x6d8eb80 以下是一些建议,似乎您的代表已被处决http ://imlocation.wordpress.com/2007/09/13/strange-objects-nscftype-in​​dicate-memory-management-bugs/ [__NSCFType searchKeyword:]:无法识别的选择器已发送到实例0x6d8eb80

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM