Skip to main content

InputTextView

A view for inputting text with placeholder support. Since it is a subclass of UITextView, the UITextViewDelegate can be used to observe text changes.

@objc(StreamInputTextView)
open class InputTextView: UITextView, AppearanceProvider

Inheritance

AppearanceProvider, UITextView

Properties

clipboardAttachmentDelegate

The delegate which gets notified when an attachment is pasted into the text view

open weak var clipboardAttachmentDelegate: InputTextViewClipboardAttachmentDelegate?

isPastingImagesEnabled

Whether this text view should allow images to be pasted

open var isPastingImagesEnabled: Bool = true

placeholderLabel

Label used as placeholder for textView when it's empty.

open private(set) lazy var placeholderLabel: UILabel = UILabel()
.withoutAutoresizingMaskConstraints
.withBidirectionalLanguagesSupport

text

override open var text: String!

minimumHeight

The minimum height of the text view. When there is no content in the text view OR the height of the content is less than this value, the text view will be of this height

open var minimumHeight: CGFloat 

heightConstraint

The constraint responsible for setting the height of the text view.

open var heightConstraint: NSLayoutConstraint?

maximumHeight

The maximum height of the text view. When the content in the text view is greater than this height, scrolling will be enabled and the text view's height will be restricted to this value

open var maximumHeight: CGFloat 

attributedText

override open var attributedText: NSAttributedString! 

Methods

didMoveToSuperview()

override open func didMoveToSuperview() 

setUp()

open func setUp() 

setUpAppearance()

open func setUpAppearance() 

setUpLayout()

open func setUpLayout() 

replaceSelectedText(_:)

Sets the given text in the current caret position. In case the caret is selecting a range of text, it replaces that text.

open func replaceSelectedText(_ text: String) 

Parameters

  • text: A string to replace the text in the caret position.

textDidChangeProgrammatically()

open func textDidChangeProgrammatically() 

handleTextChange()

@objc open func handleTextChange() 

setTextViewHeight() - deprecated

open func setTextViewHeight() 

canPerformAction(_:withSender:)

override open func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool 

paste(_:)

override open func paste(_ sender: Any?) 

Did you find this page helpful?