UITextView
class UITextView : UIScrollView, UITextInput, UIContentSizeCategoryAdjusting
This extesion adds some useful functions to UITextView.
-
init(frame:text:font:textColor:alignment:dataDetectorTypes:editable:selectable:returnKeyType:keyboardType:secure:autocapitalizationType:keyboardAppearance:enablesReturnKeyAutomatically:autocorrectionType:delegate:)
Create an UITextView and set some parameters.
Declaration
Swift
public convenience init(frame: CGRect, text: String, font: UIFont, textColor: UIColor, alignment: NSTextAlignment, dataDetectorTypes: UIDataDetectorTypes, editable: Bool, selectable: Bool, returnKeyType: UIReturnKeyType, keyboardType: UIKeyboardType, secure: Bool, autocapitalizationType: UITextAutocapitalizationType, keyboardAppearance: UIKeyboardAppearance, enablesReturnKeyAutomatically: Bool, autocorrectionType: UITextAutocorrectionType, delegate: UITextViewDelegate?)
Parameters
frame
TextView frame.
text
TextView text.
font
TextView text font.
textColor
TextView text color.
alignment
TextView text alignment.
dataDetectorTypes
TextView data detector types.
editable
Set if TextView is editable.
selectable
Set if TextView is selectable.
returnKeyType
TextView return key type.
keyboardType
TextView keyboard type.
secure
Set if the TextView is secure or not.
autocapitalizationType
TextView text capitalization.
keyboardAppearance
TextView keyboard appearence.
enablesReturnKeyAutomatically
Set if the TextView has to automatically enables the return key.
autocorrectionType
TextView auto correction type.
delegate
TextView delegate. Set nil if it has no delegate.
-
init(frame:text:font:fontSize:textColor:alignment:dataDetectorTypes:editable:selectable:returnKeyType:keyboardType:secure:autocapitalizationType:keyboardAppearance:enablesReturnKeyAutomatically:autocorrectionType:delegate:)
Create an UITextView and set some parameters.
Declaration
Swift
public convenience init(frame: CGRect, text: String, font: FontName, fontSize: CGFloat, textColor: UIColor, alignment: NSTextAlignment, dataDetectorTypes: UIDataDetectorTypes, editable: Bool, selectable: Bool, returnKeyType: UIReturnKeyType, keyboardType: UIKeyboardType, secure: Bool, autocapitalizationType: UITextAutocapitalizationType, keyboardAppearance: UIKeyboardAppearance, enablesReturnKeyAutomatically: Bool, autocorrectionType: UITextAutocorrectionType, delegate: UITextViewDelegate?)
Parameters
frame
TextView frame.
text
TextView text.
font
TextView text font name.
fontSize
TextView text size.
textColor
TextView text color.
alignment
TextView text alignment.
dataDetectorTypes
TextView data detector types.
editable
Set if TextView is editable.
selectable
Set if TextView is selectable.
returnKeyType
TextView return key type.
keyboardType
TextView keyboard type.
secure
Set if the TextView is secure or not.
autocapitalizationType
TextView text capitalization.
keyboardAppearance
TextView keyboard appearence.
enablesReturnKeyAutomatically
Set if the TextView has to automatically enables the return key.
autocorrectionType
TextView auto correction type.
delegate
TextView delegate. Set nil if it has no delegate.
-
Paste the pasteboard text to UITextView
Declaration
Swift
public func pasteFromPasteboard()
-
Copy UITextView text to pasteboard
Declaration
Swift
public func copyToPasteboard()