How to connect dynamically created objects with Interface Builder object instances in Cocoa?
I use an IBOutlet to refer between objects created in Interface Builder, BUT...
I need to connect an object pointer (or sth) declared in an NSOperation (MyOperation) subclass with my application Controller (with an IBOutlet?) to invoke some methods of AppController. Is there any way to connect (or bind) them ?
What is the best practice to refer to AppController or any other instance created in Interface builder (added as objects) from other objects that are not created on IB too (lets say d开发者_StackOverflowynamically created in runtime) ?
The way to do this is to have something that does have an IBOutlet to your object either push pointers to that object into things that are dynamically created, or provide a method for other objects to get that reference.
IBOutlet doesn't make sense in the context of something that is created dynamically, and thus doesn't exist in your nib.
精彩评论