• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Multiple Instances with Multiple Connections in IB - how to?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple Instances with Multiple Connections in IB - how to?


  • Subject: Multiple Instances with Multiple Connections in IB - how to?
  • From: Peter Teeson <email@hidden>
  • Date: Wed, 24 Oct 2012 18:45:43 -0400

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
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Multiple Instances with Multiple Connections in IB - how to?
      • From: Quincey Morris <email@hidden>
  • Prev by Date: sdk 5.1.1 anyone?
  • Next by Date: Re: sdk 5.1.1 anyone?
  • Previous by thread: Re: sdk 5.1.1 anyone?
  • Next by thread: Re: Multiple Instances with Multiple Connections in IB - how to?
  • Index(es):
    • Date
    • Thread