PUTextView
@IBDesignable
open class PUTextView : UITextView, PUXIBPlaceholderLocalizable, PUInspectable
PowerUpSwift: The subclass of UITextView
that allows the editing of additional UIKit properties via the Interface Builder.
-
Declaration
Swift
@IBInspectable open var xibPlaceholderLocKey: String? { get set }
-
Declaration
Swift
@IBInspectable open var cornerRadius: CGFloat { get set }
-
Declaration
Swift
@IBInspectable open var borderWidth: CGFloat { get set }
-
Declaration
Swift
@IBInspectable open var borderColor: UIColor? { get set }
-
Declaration
Swift
@IBInspectable open var shadowRadius: CGFloat { get set }
-
Declaration
Swift
@IBInspectable open var shadowOpacity: Float { get set }
-
Declaration
Swift
@IBInspectable open var shadowOffset: CGSize { get set }
-
Declaration
Swift
@IBInspectable open var shadowColor: UIColor? { get set }
-
PowerUpSwift: The custom-built placeholder since Apple does not provide a
placeholder
forUITextView
.Declaration
Swift
@IBInspectable open var placeholder: String? { get set }
-
PowerUpSwift: The text color of the custom-built placeholder. Defaults
UIColor(r: 255, g: 255, b: 255, a: 0.25)
.Declaration
Swift
@IBInspectable open var placeholderColor: UIColor { get set }
-
PowerUpSwift: The user-defined minimum height. Defaults to 30.
Declaration
Swift
@IBInspectable open var minExpandableHeight: CGFloat
-
PowerUpSwift: The user-defined maximum height. Once reached, the text view becomes scrollable. Defaults to 30.
Declaration
Swift
@IBInspectable open var maxExpandableHeight: CGFloat
-
PowerUpSwift: The top padding. Defaults to 0.
Declaration
Swift
@IBInspectable open var topInset: CGFloat { get set }
-
PowerUpSwift: The left padding. Defaults to 0.
Declaration
Swift
@IBInspectable open var leftInset: CGFloat { get set }
-
PowerUpSwift: The bottom padding. Defaults to 0.
Declaration
Swift
@IBInspectable open var bottomInset: CGFloat { get set }
-
PowerUpSwift: The right padding. Defaults to 0.
Declaration
Swift
@IBInspectable open var rightInset: CGFloat { get set }
-
PowerUpSwift: Calculates the new height of the text view based on the size of the content and the user-defined
maxExpandableHeight
. You should reference an@IBOutlet
to the height constraint. Make sure thePUTextView
‘s delegate is also set via the Interface Builder or via code.Example
@IBOutlet powerUpTextView: PowerUpTextView! @IBOutlet powerUpTextViewHeightConstraint: NSLayoutConstraint! func textViewDidChange(_ textView: UITextView) { powerUpTextViewHeightConstraint.constant = powerUpTextView.newExpandableHeight }
Declaration
Swift
open var newExpandableHeight: CGFloat { get }
-
PowerUpSwift: Toggles the visibility of the text view’s placeholder.
Example
func textViewDidChange(_ textView: UITextView) { powerUpTextView.refreshPlaceholder() }
Declaration
Swift
open func refreshPlaceholder()
-
PowerUpSwift: Clears the text view and sets the placeholder to visible.
Declaration
Swift
open func clear()