Re: Unable to make connection in IB
Re: Unable to make connection in IB
- Subject: Re: Unable to make connection in IB
- From: Fritz Anderson <email@hidden>
- Date: Wed, 10 Oct 2012 10:34:46 -0500
On 9 Oct 2012, at 9:36 PM, Peter Teeson <email@hidden> wrote:
> Using BezierPathLab as example code I am trying to make
> (0) a Document app
> (1) The window has 2 objects (a) an NSColorWell and (b) a Custom View from my sub-class MyView : NSView
> (2) MyView.h has IBOutlet NSColorWell *startColorWell; and - (IBAction)changeStartColor:(NSColor *)sender;
> (3) I can connect startColorWell as a referencing outlet to the NSColorWell
> The Problem
> (4) I am not able to connect the NSColorWell itself to the IBAction (Ctl drag) that is in the MyView.h file (i.e. as a selector)
You don't mean NSColor for the argument to the changeStartColor: action. I believe IB excludes methods whose signatures don't match the objects you're trying to connect. You may mean NSColorWell, and if that doesn't work, use id.
> But
> (5) If I move the IBAction into the NSDocument.h I can make the connection.
> In fact that's what I did to start with and it generated the IBAction definition (as per above).
Don't Do That. I assume this was just an experiment on your part. However, I don't know why it should work in NSDocument, when it didn't in your NSDocument subclass.
And your methods should be in your NSDocument subclass, or in some other controller class other than an NSView subclass. This may be a matter of MVC design and not the problem you're having, but implementing an IBAction in a view is a _strong_ code smell.
— F
_______________________________________________
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