iOS - UITextView

UITextView变量
@property(null_resettable,nonatomic,copy) NSString *text;
// 显示的文本
@property(nullable,nonatomic,strong) UIFont *font;
// 设置字体
@property(nullable,nonatomic,strong) UIColor *textColor;
// 设置字体颜色
@property(nonatomic) NSTextAlignment textAlignment;    // default is NSLeftTextAlignment
// 显示文本的对齐方式
@property(nonatomic) NSRange selectedRange;
// 可编辑选择的范围
@property(nonatomic,getter=isEditable) BOOL editable __TVOS_PROHIBITED;
// 是否可以编辑
@property(nonatomic,getter=isSelectable) BOOL selectable NS_AVAILABLE_IOS(7_0); // toggle selectability, which controls the ability of the user to select content and interact with URLs & attachments
// 是否可以选择
@property(nonatomic) UIDataDetectorTypes dataDetectorTypes NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;  
// 可识别文本类型, 如 电话, 网址, 住址, 邮箱等, 相应的设置后, 若点击则可跳转相应的操作
// 源文档
Discussion
You can use this property to specify the types of data (phone numbers, http links, and so on) that should be automatically converted to URLs in the text view. When tapped, the text view opens the application responsible for handling the URL type and passes it the URL.
Availability
Available in iOS 3.0 and later.

@property(nonatomic) BOOL allowsEditingTextAttributes NS_AVAILABLE_IOS(6_0); // defaults to NO
// 是否允许编辑Attributes的文本.
@property(null_resettable,copy) NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0);
// 富文本的文字;
@property(nonatomic,copy) NSDictionary *typingAttributes NS_AVAILABLE_IOS(6_0); // automatically resets when the selection changes
// 全部文本所表示的一个样式
 源文档.
Discussion
This dictionary contains the attribute keys (and corresponding values) to apply to newly typed text. When the text view’s selection changes, the contents of the dictionary are cleared automatically.
Availability
Available in iOS 6.0 and later.

@property(nonatomic) BOOL clearsOnInsertion NS_AVAILABLE_IOS(6_0); // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO.
// 设置textView获得焦点,在用户使用虚拟键盘进行输入时,清除之前的文本
原文档

@property(nonatomic, copy) NSDictionary  *linkTextAttributes  The attributes to apply to links.
// 支持连接的样式.
// 源文档 
Discussion
The default attributes specify blue text with a single underline and the pointing hand cursor.
Availability
Available in iOS 7.0 and later.

@property (nullable, readwrite, strong) UIView *inputView; 
// 当textView变为第一响应的时候, 从底部弹出的视图, 不设置时, 默认是键盘. 
@property (nullable, readwrite, strong) UIView *inputAccessoryView;
// 位于inputView上方的视图, 例如: 可以做个按钮, 显示在键盘的上边, 以用于回收键盘.
@property(nonatomic) BOOL clearsOnInsertion NS_AVAILABLE_IOS(6_0); // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO.
// 设置textView获得焦点,在用户使用虚拟键盘进行输入时,清除之前的文本
@property(nonatomic, assign) UIEdgeInsets textContainerInset NS_AVAILABLE_IOS(7_0);
// 显示文本的区域.  默认是 (8, 0, 8, 0).
UITextView方法
- (void)scrollRangeToVisible:(NSRange)range;
// 滚动到指定 range
UITextViewDelegate 方法
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView;
// 是否应该开始编辑
- (void)textViewDidBeginEditing:(UITextView *)textView;
// 已经开始编辑
- (void)textViewDidEndEditing:(UITextView *)textView;
// 结束编辑
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
// 文本改变是否显示
- (void)textViewDidChange:(UITextView *)textView;
// 文本已经改变
- (void)textViewDidChangeSelection:(UITextView *)textView;
// 
通知
UIKIT_EXTERN NSString * const UITextViewTextDidBeginEditingNotification;
UIKIT_EXTERN NSString * const UITextViewTextDidChangeNotification;
UIKIT_EXTERN NSString * const UITextViewTextDidEndEditingNotification;

@property(nonatomic,readonly) NSTextContainer *textContainer NS_AVAILABLE_IOS(7_0);
// The text container object defining the area in which text is displayed in this text view. (read-only)
@property(nonatomic,readonly) NSLayoutManager *layoutManager NS_AVAILABLE_IOS(7_0);
// The layout manager that lays out text for the receiver’s text container. (read-only)  
@property(nonatomic,readonly,strong) NSTextStorage *textStorage NS_AVAILABLE_IOS(7_0);
// The text storage object holding the text displayed in this text view. (read-only)

你可能感兴趣的:(iOS - UITextView)