Pregunta

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.

However, I just can't CTRL+Drag a simple button from inside this view to MyTableCellView.h in order to create an IBOutlet.

Here is a video to show what happens: http://youtu.be/sNNbuVT-SZs.

How the view is subclassed:

NSTableCellView subclassed

How I try to CTRL+Drag a button

CTRL+Dragging a NSButton

Also, sometimes, Interface Builder just don't allow the cell view's class to be modified. What's happening ?

¿Fue útil?

Solución

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:

Manually create an outlet:

@property(retain, nonatomic) IBOutlet NSButton* button;

Then click the empty circle on the left, and drag it to your XIB file's button:

enter image description here

I have no idea why it works this way, please let me know if you know the anwser.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top