Re: Unable to make connection in IB
Re: Unable to make connection in IB
- Subject: Re: Unable to make connection in IB
- From: Peter Teeson <email@hidden>
- Date: Wed, 10 Oct 2012 13:05:53 -0400
On 2012-10-10, at 11:34 AM, Fritz Anderson wrote:
> 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.
Thank you. That was it! Changed it to NSColorWell and was able to connect it.
>> 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.
Really? Would you please expand a bit more please? The BezierPathLab has all kinds of methods implemented in the view subclass.
Granted they are not marked with the IBAction macro but they are connected and if I undo the connection it is needed to re-connect.
Probably connected in an earlier version of IB where IIRC you could do that.
Is you comment restricted to IBAction methods.
_______________________________________________
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