ASControlNode Class Reference

Inherits from ASDisplayNode : ASDealloc2MainObject
Declared in ASControlNode.h

Overview

ASControlNode cannot be used directly. It instead defines the common interface and behavior structure for all its subclasses. Subclasses should import “ASControlNode+Subclasses.h” for information on methods intended to be overriden.

  enabled

Indicates whether or not the receiver is enabled.

@property (nonatomic, assign, getter=isEnabled) BOOL enabled

Discussion

Specify YES to make the control enabled; otherwise, specify NO to make it disabled. The default value is YES. If the enabled state is NO, the control ignores touch events and subclasses may draw differently.

Declared In

ASControlNode.h

  highlighted

Indicates whether or not the receiver is highlighted.

@property (nonatomic, assign, getter=isHighlighted) BOOL highlighted

Discussion

This is set automatically when the there is a touch inside the control and removed on exit or touch up. This is different from touchInside in that it includes an area around the control, rather than just for touches inside the control.

Declared In

ASControlNode.h

  selected

Indicates whether or not the receiver is highlighted.

@property (nonatomic, assign, getter=isSelected) BOOL selected

Discussion

This is set automatically when the receiver is tapped.

Declared In

ASControlNode.h

  tracking

Indicates whether or not the receiver is currently tracking touches related to an event.

@property (nonatomic, readonly, assign, getter=isTracking) BOOL tracking

Discussion

YES if the receiver is tracking touches; NO otherwise.

Declared In

ASControlNode.h

  touchInside

Indicates whether or not a touch is inside the bounds of the receiver.

@property (nonatomic, readonly, assign, getter=isTouchInside) BOOL touchInside

Discussion

YES if a touch is inside the receiver’s bounds; NO otherwise.

Declared In

ASControlNode.h

– addTarget:action:forControlEvents:

Adds a target-action pair for a particular event (or events).

- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(ASControlNodeEvent)controlEvents

Parameters

target

The object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message. target is not retained.

action

A selector identifying an action message. May optionally include the sender and the event as parameters, in that order. May not be NULL.

controlEvents

A bitmask specifying the control events for which the action message is sent. May not be 0. See “Control Events” for bitmask constants.

Discussion

You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. Targets are held weakly.

Declared In

ASControlNode.h

– actionsForTarget:forControlEvent:

Returns the actions that are associated with a target and a particular control event.

- (nullable NSArray<NSString*> *)actionsForTarget:(id)target forControlEvent:(ASControlNodeEvent)controlEvent

Parameters

target

The target object. May not be nil.

controlEvent

A single constant of type ASControlNodeEvent that specifies a particular user action on the control; for a list of these constants, see “Control Events”. May not be 0 or ASControlNodeEventAllEvents.

Return Value

An array of selector names as NSString objects, or nil if there are no action selectors associated with controlEvent.

Declared In

ASControlNode.h

– allTargets

Returns all target objects associated with the receiver.

- (NSSet *)allTargets

Return Value

A set of all targets for the receiver. The set may include NSNull to indicate at least one nil target (meaning, the responder chain is searched for a target.)

Declared In

ASControlNode.h

– removeTarget:action:forControlEvents:

Removes a target-action pair for a particular event.

- (void)removeTarget:(nullable id)target action:(nullable SEL)action forControlEvents:(ASControlNodeEvent)controlEvents

Parameters

target

The target object. Pass nil to remove all targets paired with action and the specified control events.

action

A selector identifying an action message. Pass NULL to remove all action messages paired with target.

controlEvents

A bitmask specifying the control events associated with target and action. See “Control Events” for bitmask constants. May not be 0.

Declared In

ASControlNode.h

– sendActionsForControlEvents:withEvent:

Sends the actions for the control events for a particular event.

- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event

Parameters

controlEvents

A bitmask specifying the control events for which to send actions. See “Control Events” for bitmask constants. May not be 0.

event

The event which triggered these control actions. May be nil.

Declared In

ASControlNode.h

– setDefaultFocusAppearance

How the node looks when it isn’t focused. Exposed here so that subclasses can override.

- (void)setDefaultFocusAppearance

Declared In

ASControlNode.h