TextEditingToolController

@available(iOS 9.0, *)
open class TextEditingToolController<SpriteModelType> : PhotoEditToolController, UITextViewDelegate, ColorCollectionViewDelegate where SpriteModelType : SpriteModel

The tool controller to add or update to in image. It contains a text view and a dimming view.

Properties

  • The dimming view that dims the content behind the textView.

    Declaration

    Swift

    open private(set) lazy var dimmingView: UIView = {
      let dimmingView = UIView()
      dimmingView.translatesAutoresizingMaskIntoConstraints = false
      dimmingView.backgroundColor = UIColor.black.withAlphaComponent(0.8)
      return dimmingView
    }()
  • The text view that is used to insert or update text.

    Declaration

    Swift

    open private(set) lazy var textView: UITextView = {
      let textView = UITextView()
      textView.accessibilityIdentifier = "pesdk_common_accessibility_textEditingTextView"
      textView.translatesAutoresizingMaskIntoConstraints = false
      textView.backgroundColor = UIColor.clear
      textView.font = UIFont.systemFont(ofSize: 16)
      textView.textAlignment = view.userInterfaceLayoutDirection == .rightToLeft ? .right : .left
      textView.delegate = self
      return textView
    }()
  • The color collection view used to display a color selection.

    Declaration

    Swift

    open private(set) lazy var colorCollectionView: ColorCollectionView = {
      let colorCollectionView = ColorCollectionView()
      colorCollectionView.delegate = self
      colorCollectionView.translatesAutoresizingMaskIntoConstraints = false
      colorCollectionView.backgroundColor = .clear
      return colorCollectionView
    }()
  • When this property is set, the tool will update the given SpriteModelType instead of creating a new one.

    Declaration

    Swift

    open var spriteModel: SpriteModelType?

Setup

  • Updates the text view’s properties to reflect the sprite model. Subclasses should implement this to update the view properly.

    Declaration

    Swift

    open func loadStateFromModel()

PhotoEditModel

  • Creates a sprite model with the information from the text view. Subclasses should implement this method to return a proper sprite model.

    Declaration

    Swift

    open func createSpriteModelFromTextView() -> SpriteModelType?

    Return Value

    The sprite model that was created from the text view or nil.