• 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: Subclassing From Code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing From Code?


  • Subject: Re: Subclassing From Code?
  • From: Shaun Wexler <email@hidden>
  • Date: Sun, 16 Nov 2003 22:15:16 -0800

On Nov 16, 2003, at 5:51 PM, David McGavern wrote:

How can I dynamically make a class a subclass of another class, from code? For example, if I have an LWSearchField (my own class) that I want to make into a NSSearchField (if 10.3 is detected). Any help is greatly appreciated :-).

Most likely that won't be necessary. Have a look at:

http://developer.apple.com/documentation/Cocoa/Conceptual/Foundation/ Concepts/ClassClusters.html

If LWSearchField inherits from NSTextField, and covers the same methods and method signatures as NSSearchField, your init method can simply return an instance of NSSearchField if you're on 10.3, or in your LWSearchField cellClass method, return the NSSearchFieldCell class instead.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Subclassing From Code? (From: David McGavern <email@hidden>)

  • Prev by Date: Re: Subclassing From Code?
  • Next by Date: Detecting option key down/up during drag
  • Previous by thread: Re: Subclassing From Code?
  • Next by thread: Re: Subclassing From Code?
  • Index(es):
    • Date
    • Thread