Can you manually implement Cocoa bindings?

后端 未结 4 1343
一向
一向 2020-12-04 08:53

I\'ve had a crack at implementing bindings for my own NSView subclass. It works, but there are problems with retain cycles when binding to File\'s Owner from a nib file. Aft

4条回答
  •  孤街浪徒
    2020-12-04 09:32

    You may want to check out the NSKeyValueBindingCreation Protocol. It lets you create bindings programmatically through code. (Remember to do the work in an awakeFromNib method if you need to reference IBOutlet variables or they could be nil.)

提交回复
热议问题