Xcode 4.5.1 Lion 10.7.4 I have desktop Document project with a sub-class of NSView. The Window has 2 instances of this sub-class (basically squares that have gradients); The only difference between the two instances are the start and stop mid points for the gradients. That's controlled by an ivar, isPushed, like so in the Document awakeFromNib. The 2 View vars are pointing at and connected to the sub-class instances.
-(void)awakeFromNib{ [normalView setIsPushed:NO]; [pushedView setIsPushed:YES]; }
The sub-class has these methods to set the gradient Start and Stop colors - (IBAction)changeStartColor:(NSColorWell *)sender;
-(void)changeStartColor:(NSColorWell *)sender{ [self setStartColor:[sender color]]; }
- (void)setStartColor:color{ startColor = color; [self setNeedsDisplay:YES]; }
Similarly for the stopColor.
The Problem: In IB I can set a Received action by selecting one of the instances and Ctl-dragging. For example normalView and it appears there and works. But if I now try to select the same thing for pushedView then the connection for normal view is undone.
Yet the methods will work correctly regardless of the Start and Stop mid-points.
How can I set the connections for both instances to use the these methods? Can it be done in IB? Or must it be done in code? If so what does the code look like?
TIA for your advice.
Peter |