• 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: Patrick Machielse <email@hidden>
  • Date: Mon, 17 Nov 2003 13:07:43 +0100

op 17-11-2003 06:50 schreef David McGavern op cocoa-dev-request:

> 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 :-).

David,

If I translate your question to: "I want my program to show a native
NSSearchField when running under 10.3 and an LWSearchField under 10.2 and
earlier" I can think of several solutions:

1) create two different nib's (or window objects inside a nib) and load the
appropriate one for each OS version.

2) after loading your window, check the OS version and dynamically exchange
the ...searchfield if needed.

Option 1 would seem to involve less code, since you'll have to wire up your
searchfields by hand using method 2). There are probably more solutions,
like using a 'widget factory' sporting a method like +(id)nativeSearchField,
but that would probably complicate / change the your program.

Patrick
_______________________________________________
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.

  • Prev by Date: Re: Strange characters in Toolbar
  • Next by Date: Re: Strange characters in Toolbar
  • Previous by thread: Re: Subclassing From Code?
  • Next by thread: How to prevent NSTableColumn from moving
  • Index(es):
    • Date
    • Thread