ASEditableTextNode Class Reference

Inherits from ASDisplayNode : ASDealloc2MainObject
Conforms to UITextInputTraits
Declared in ASEditableTextNode.h

Overview

Does not support layer backing.

– init

Initializes an editable text node using default TextKit components.

- (instancetype)init

Return Value

An initialized ASEditableTextNode.

Declared In

ASEditableTextNode.h

– initWithTextKitComponents:placeholderTextKitComponents:

Initializes an editable text node using the provided TextKit components.

- (instancetype)initWithTextKitComponents:(ASTextKitComponents *)textKitComponents placeholderTextKitComponents:(ASTextKitComponents *)placeholderTextKitComponents

Parameters

textKitComponents

The TextKit stack used to render text.

placeholderTextKitComponents

The TextKit stack used to render placeholder text.

Return Value

An initialized ASEditableTextNode.

Declared In

ASEditableTextNode.h

  scrollEnabled

Enable scrolling on the textView @default true

@property (nonatomic) BOOL scrollEnabled

Declared In

ASEditableTextNode.h

  textView

Access to underlying UITextView for more configuration options.

@property (nonatomic, readonly, strong) UITextView *textView

Discussion

Warning: This property should only be used on the main thread and should not be accessed before the editable text node’s view is created.

Declared In

ASEditableTextNode.h

– isDisplayingPlaceholder

Indicates if the receiver is displaying the placeholder text.

- (BOOL)isDisplayingPlaceholder

Return Value

YES if the placeholder is currently displayed; NO otherwise.

Discussion

To update the placeholder, see the attributedPlaceholderText property.

Declared In

ASEditableTextNode.h

  attributedPlaceholderText

The styled placeholder text displayed by the text node while no text is entered

@property (nonatomic, readwrite, strong, nullable) NSAttributedString *attributedPlaceholderText

Discussion

The placeholder is displayed when the user has not entered any text and the keyboard is not visible.

Declared In

ASEditableTextNode.h

  attributedText

The styled text displayed by the receiver.

@property (nonatomic, readwrite, copy, nullable) NSAttributedString *attributedText

Discussion

When the placeholder is displayed (as indicated by -isDisplayingPlaceholder), this value is nil. Otherwise, this value is the attributed text the user has entered. This value can be modified regardless of whether the receiver is the first responder (and thus, editing) or not. Changing this value from nil to non-nil will result in the placeholder being hidden, and the new value being displayed.

Declared In

ASEditableTextNode.h

  textContainerInset

The textContainerInset of both the placeholder and typed textView. This value defaults to UIEdgeInsetsZero.

@property (nonatomic, readwrite) UIEdgeInsets textContainerInset

Declared In

ASEditableTextNode.h

  autocapitalizationType

properties.

@property (nonatomic, readwrite, assign) UITextAutocapitalizationType autocapitalizationType

Declared In

ASEditableTextNode.h

– isFirstResponder

Indicates whether the receiver’s text view is the first responder, and thus has the keyboard visible and is prepared for editing by the user.

- (BOOL)isFirstResponder

Return Value

YES if the receiver’s text view is the first-responder; NO otherwise.

Declared In

ASEditableTextNode.h

– frameForTextRange:

Returns the frame of the given range of characters.

- (CGRect)frameForTextRange:(NSRange)textRange

Parameters

textRange

A range of characters.

Return Value

A CGRect that is the bounding box of the glyphs covered by the given range of characters, in the coordinate system of the receiver.

Discussion

This method raises an exception if textRange is not a valid range of characters within the receiver’s attributed text.

Declared In

ASEditableTextNode.h