• 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
Re: Need to override +(Class) class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Need to override +(Class) class? (From: Stuart Rogers <email@hidden>)

  • Prev by Date: CIPageCurlTransition and starting corner
  • Next by Date: Re: showing window causes EXC_BAD_ACCESS
  • Previous by thread: Re: Need to override +(Class) class?
  • Next by thread: Making NSTableView column headers editable
  • Index(es):
    • Date
    • Thread