简体   繁体   中英

Wiring NSToolBarItem with XIBs

For some reason I'm having a very difficult time wiring my NSToolbarItem to an IBAction.

I'm using an NSWindowController with its own XIB. The NSToolbar is dropped into the XIB, and I added the NSToolbarItem without issue. This whole NSWindowController is created by a master NSViewController when an image is clicked.

The problem lies with the new button not sending. I unchecked " Autovalidates " and checked " Selectable " so that I could actually click the button.

However when pressed, I receive " unrecognized selector sent to instance ".

I've wired this several times over through the XIB interface to make sure I wasn't messing up.

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 . 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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