• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing


  • Subject: Re: Subclassing
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 14 Oct 2001 00:46:53 +0100

Sam,

>>>>>> Sam Goldman (SG) wrote at Sat, 13 Oct 2001 14:51:54 -0700:
SG> Well, I am pretty familiar with ObjC/Cocoa, but not subclassing. Can you
SG> (or anyone else, direct me to some documentation about it. It looks like

For starters, you can try /Developer/Documentation/Cocoa/ObjectiveC.

SG> it is the most powerful feature of this language and I want to know it.

It's difficult to judge what's more and what's less powerful, but I guess
the dynamic messaging system (actually invited ages ago in Smalltalk) would
win. Not only it simplyfies inheritance; it also allows things like message
forwarding and much more.

SG> Since it seems like NSView is the thing to subclass first (I've done it

I'd guess NSObject is the thing to subclass first. NSView is probably the
first candidate from AppKit though.

SG> before, but only drawn squares in it), are there any advanced
SG> examples/tutorials for it (except Sketch, which I am working on).

If you want to learn subclassing per se, subclass NSObject and your own
classes. If you want to subclass some specific class, RTFM and check
examples.

Actually, subclassing is so simple that there is no need for "advanced
examples". You just make a subclass, add some properties, implement some
methods, and that's it. There are some handy conventions (like designated
initializers) and some caveats (like class clusters), but even that is pretty
primitive and quite well documented.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc


  • Prev by Date: NSScrollView: Limiting scrolling size...
  • Next by Date: Silkscreened Image in OS X Installer
  • Previous by thread: RE: Subclassing
  • Next by thread: Changing Desktop picture from Cocoa app in 10.1 without re-starting Finder
  • Index(es):
    • Date
    • Thread