Re: Need to override +(Class) class?
Re: Need to override +(Class) class?
- Subject: Re: Need to override +(Class) class?
- From: Dave DeLong <email@hidden>
- Date: Sun, 28 Sep 2008 09:00:16 -0600
I have a good reason to not be able to do this. InputElements are
cross-platform, but InputViews only exist on one platform. As such,
the frameworks required to build InputViews will not always be
available to the InputElement class.
I could get around it, I suppose, if I put in compiler directives in
InputElement's .h and .m files, but that starts to make things a
little messy.
Dave
On 28 Sep, 2008, at 3:53 AM, Stuart Rogers wrote:
As an aside... If InputElementButton and InputElementSlider had a
common superclass, and InputViewButton and InputViewSlider had a
common superclass, you could simplify your code along the lines of:
for (InputElement * element in [inputMode elements])
{
InputView *inputView = [element buildInputView];
// ...
}
...where -buildInputView is declared by the InputElement superclass
and overridden by the subclasses as necessary, returning a suitable
InputView subclass.
Of course you might have good reason to know the class at run time,
but in most cases I've come across (in my limited experience) there's
usually a simpler approach that avoids it.
_______________________________________________
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