On Oct 24, 2012, at 18:59 , Peter Teeson < email@hidden> wrote: But what I would like to achieve is that the IBAction targets both instances so the new colour is set for both of them.
I suppose I could make a method in the Document class akin to the one I used to set the isPushed ivar in my sub-class. But then why bother with an IBAction.
Perhaps it is not allowed to have an Action that Targets multiple instances. Or perhaps my understanding is flawed.
The "received" action in IB is something of a fiction -- the color well is the initiator of the action, and it can have only one target. (In the old days, IIRC, you would have had to drag *from* the color well to the target view.)
If you chose to use 2 color wells, you should be able to connect one to each custom view. If you want a single color well to affect both, then you need to target your action to something shared, i.e. a controller, which knows how to set each of the custom views' color. Depending on the structure of your window, it might make sense to send the action to the window controller, or a view controller, or some other object.
In other words, rather than thinking of two custom views being forced to the same underlying color, think of them as *using* a single color property of … something. Probably the window controller, unless you have a better choice.
|