| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
@interface NPRolloverButton : NSImageView {
NSImage *normalState;
NSImage *overState;
NSImage *downState;
id <NPRolloverProtocol> controller;
SEL downEvent;
}
The controller is not in the nib file at
all. All of the initialization of the custom button is done in its
-awakeFromNib method, which means that the controller object won't be
created yet (since non-nib objects are created after nib-based objects are).
So I want to call alloc and init on 'controller'. This is the first problem.
How the heck do I allocate and initialize a dynamically typed object? I have
no idea what the class is,
and I have tried using things like [controller
class] in the alloc-init statement (formed like [[[controller class] alloc]
init];), but that doesn't work at all. The program still compiles, but I get
a warning that says that -class isn't implemented by the protocol, and then
when that line is executed... nothing happens.
A second problem is that whenever I call ANY method on the controller (other
than a method that is part of the protocol, such as -performSelector), the
compiler issues a warning that says that -performSelector isn't part of the
protocol. But since -performSelector is a function of NSObject, it is a
given that all classes will be able to perform -performSelector.
| References: | |
| >Using Protocols (complete message this time...) (From: mw <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.