Inherits from NSObject
Conforms to NSLocking
Declared in CC3NodeListeners.h

Overview

Manages a collection of transform listeners on behalf of a CC3Node.

Properties

count

Returns the number of listeners.

@property (nonatomic, readonly) NSUInteger count

Declared In

CC3NodeListeners.h

isEmpty

Returns whether there are no listeners.

@property (nonatomic, readonly) BOOL isEmpty

Declared In

CC3NodeListeners.h

transformListeners

Returns a copy of the collection of objects that have requested that they be notified whenever the transform of the node has changed.

@property (nonatomic, retain, readonly) NSSet *transformListeners

Discussion

Each object in the returned collection implements the CC3NodeTransformListenerProtocol, and will be sent the nodeWasTransformed: notification message when the transform of this node changes.

Objects can be added to this collection by using the addTransformListener: method, and removed using the removeTransformListener: method. This property returns a copy of the collection stored in this node. You can safely invoke the addTransformListener: or removeTransformListener: methods while iterating the returned collection.

Transform listeners are weakly referenced. Each listener should know who it has subscribed to, and must remove itself as a listener (using the removeTransformListener: method) when appropriate, such as when being deallocated.

Declared In

CC3NodeListeners.h

Class Methods

listenersForNode:

Allocates and initializes an instance to track transform listeners for the specified node.

+ (id)listenersForNode:(CC3Node *)node

Declared In

CC3NodeListeners.h

Instance Methods

addTransformListener:

Adds the specified object as a transform listener.

- (void)addTransformListener:(id<CC3NodeTransformListenerProtocol>)aListener

Discussion

It is safe to invoke this method more than once for the same listener, or with a nil listener. In either case, this method simply ignores the request.

Transform listeners are weakly referenced. Each listener should know who it has subscribed to, and must remove itself as a listener (using the removeTransformListener: method) when appropriate, such as when being deallocated.

Declared In

CC3NodeListeners.h

initForNode:

Initializes this instance to track transform listeners for the specified node.

- (id)initForNode:(CC3Node *)node

Declared In

CC3NodeListeners.h

notifyDestructionListeners

Notify the transform listeners that the node has been destroyed.

- (void)notifyDestructionListeners

Declared In

CC3NodeListeners.h

notifyTransformListeners

Notify the transform listeners that the node has been transformed.

- (void)notifyTransformListeners

Declared In

CC3NodeListeners.h

removeAllTransformListeners

Removes all transform listeners.

- (void)removeAllTransformListeners

Declared In

CC3NodeListeners.h

removeTransformListener:

Removes the specified object as a transform listener.

- (void)removeTransformListener:(id<CC3NodeTransformListenerProtocol>)aListener

Discussion

It is safe to invoke this method with a listener that was not previously added, or with a nil listener. In either case, this method simply ignores the request.

Declared In

CC3NodeListeners.h