Re: IBOutlet to different classes, conditional build
Re: IBOutlet to different classes, conditional build
- Subject: Re: IBOutlet to different classes, conditional build
- From: Trygve Inda <email@hidden>
- Date: Thu, 24 Feb 2011 07:19:54 +0000
- Thread-topic: IBOutlet to different classes, conditional build
>
> On 24/02/2011, at 5:56 PM, Trygve Inda wrote:
>
>> The problem is two-fold:
>>
>> 1) How can I have nibs, one with MyObjectClass:NSObject and the other with
>> MyObjectClass:NSPreferencePane where MyObjectClass is essentially the same
>> but with a few #ifdef to have conditional compilation.
>
> The real problem is that you're trying to define this chimera class in the
> same header. If you split it into two separate headers, each nib only needs to
> know about the header that applies to it. Target Membership will do the rest,
> since the right nib and the right header are part of the same target and
> there's no crosstalk to the other target.
>
> Since IB can't 'see' #ifdef in your header, you just can't do it in the same
> header. Neither is there any reason to. Having done that, there's probably no
> merit in trying to merge the code either, just have two separate objects, get
> rid of all the #ifdefs and use Target Membership to select the right one for
> the job.
>
>> 2) I need IBOutlets in ClassA, ClassB and ClassC to link to MyObjectClass so
>> I can't easily change it to MyObjectClassPrefStyle and MyObjectClassAppStyle
>> since then the IBOutlets would have to point to different types.
>
>
> Just make the outlets type id and they can point to anything.
>
> --Graham
>
>
>
Actually in ClassA I'd have
IBOutlet id MyObjectClassController;
And I guess in this case I would not get warnings for missing methods or
even mal-formed method calls.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden