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

Subclassing


  • Subject: Subclassing
  • From: Sam Goldman <email@hidden>
  • Date: Sat, 13 Oct 2001 01:51:07 -0700

OK, I am trying to conquer the concept of subclassing. Some of it I
understand, but then when I tried to apply what I know, nothing happened.

Basically what I did was subclass a NSButton and a NSButtonCell. I created
the source files and then connected the headers. Then I made the NSButton
use the NSButtonCell with this code:

+ (Class) cellClass
{
return [MyButtonCell class];
}

I didn't implement anything in the NSButtonCell class (MyButtonCell) so I
didn't expect anything to happen. Then, after implementing these methods:

- (NSCellImagePosition)imagePosition
{
return NSImageLeft;
}

- (NSImage *)image
{
return [NSImage imageNamed:@"StartPage"];
}

And ran the program, no image showed. Keep in mind that I am totally new to
this, so if it's a totally obvious thing, don't be too mean. Also, it seemed
to me like a lot of the methods would have to be called by a Controller
object. If that's the case (which I don't think it is), what's the point of
subclassing?

- Sam


  • Follow-Ups:
    • Re: Subclassing
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Midi Application...
  • Next by Date: Re: Backup/Unix/SCSI
  • Previous by thread: Re: Backup/Unix/SCSI
  • Next by thread: Re: Subclassing
  • Index(es):
    • Date
    • Thread