iOS UITextView控件方法简介
2016-03-11 00:00
330 查看
摘要: iOS UI基础控件
1.UITextField的初始化
2.设置和拿取文本框中的内容
@property(nullable, nonatomic, copy) NSString * text
3.通过NSAttributedString设置和拿取文本框中的内容
@property(nullable, nonatomic, copy) NSAttributedString * attributedText;
4.设置文本框内文字的颜色
@property(nullable, nonatomic, string) UIColor * textColor;
5.设置文本框中的字体大小
@property(nullable, nonatomic, strong) UIFont * font ;
6.设置文本的中文字的对齐方式
@property(nonatomic) NSTextAlignment textAlignment;
7.设置文本框的输入风格是一个枚举
@property(nonatomic) UITextBorderStyle borderStyle;
8.通过字典设置默认字体的属性,这个属性设置后会影响到全部字体的属性
@property(nonatomic ,copy) NSDictionary<NSString*, id> * defaultTextAttributes;
9.设置文本款中默认状态下的字符
@property(nullable, nonatomic, copy) NSString * placeholder;
10.通过NSAttributedString设置文本款默认状态下的字符
@property(nullable, nonatomic, copy) NSAttributedString * attributedPlaceholder;
11.设置是否在编辑时清空文本框中的内容
@property(nonatomic) BOOL clearsOnBeginEditing;
12.设置文字是否适应文本框的宽度
@property(nonatomic) BOOL adjustsFontSizeToFitWidth;
13.设置最小的字体
@prperty(nonatomic) GCFolat minimumFontSize;
14.设置UITextField的代理方法
@property(nullable, nonatomic, weak) id<UITextFieldDelegate> delegate;
15.设置文本款的背景图片,图片会被拉伸
@property(nullable, nonatomic, strong) UIImage * background;
16.设置禁用时文本框的背景图片
@property(nullable, nonatomic, strong) UIImage * disableBackground;
17.设置文本框是否正在编辑,只读属性
@property(nonatomic, readonly, getter=isEditing) BOOL editing;
18.是否允许更改字符属性字典
@property(nonatomic) BOOL allowsEditingTextAttributes;
19.设置属性字典
@property(nullable, nonatomic, copy) NSDictionary<NSString*, id>*typingAttributes;
20.设置清除按钮的样式
@property(nonatomic) UITextFieldViewMode clearbuttonMode;
21.设置文本框左边的视图和视图的样式(一块设置才有效果)
@property(nullable, nonatomic, string) UIView * leftView
@Property(nonatomic) UITextFieldViewMode leftViewMode;
22.设置文本框右边的视图和视图的样式( 是枚举)
@property(nullable, nonatomic, string) UIView * rightView
@Property(nonatomic) UITextFieldViewMode rightViewMode;
23.(??????)通过重写这几个方法可以改变相应视图的位置
24.(????)这两个视图还有疑问,没有使用过
25.设置输入框成为第一响应者时弹出的视图和辅助视图(类似键盘)
@property(nullable, readwrite, strong) UIView * inputView;
@property(nullable, readwrite, strong) UIView * inputAccessoryView;(accessory附件);
26.是否允许再次编辑是可以在内容中间插入内容
@property(nonatmoic) BOOL clerasOnInsertion;
27.注销第一响应(收键盘可以???????)
- (BOOL)endEditing : (BOOL) force;
28.代理方法
@protocol UITextFieldDelegate <NSObject>
@optional
29.开始编辑时候调用的方法
- (BOOL) textFieldShouldBeginEditing : (UITextField*) textField;
30.已经结束时将要调用的方法
- (void) textFieldDidBeginEditind : (UITextField*) textField;
31.将要结束编辑时调用的方法,YES可以结束编辑,NO不能够结束编辑
- (BOOL) textFieldShouldEndEditing : (UITextField*) textField;
32.结束编辑时调用的方法
- (void) textFieldDidEndEditing : (UITextField*) textField;
33.输入字符是=时候调用的方法
- (BooL) textField : (UITextField*) textField shouldChangeCharactersInRange : (NSRange)range repolacementString : (NSString*) string;
34.点击清除时调用的方法,YES可以清除 NO不可以清除
- (BOOL) textFieldShouldClear:(UITextField*) textField;
35.点击return时候触发的方法
- (BOOL) textFieldShouldReturn: (UITextField*) textField;
1.UITextField的初始化
UITextField*field = [[UITextField alloc] initWithFrame:CGRectMake(0,0,100,100)];
2.设置和拿取文本框中的内容
@property(nullable, nonatomic, copy) NSString * text
3.通过NSAttributedString设置和拿取文本框中的内容
@property(nullable, nonatomic, copy) NSAttributedString * attributedText;
4.设置文本框内文字的颜色
@property(nullable, nonatomic, string) UIColor * textColor;
5.设置文本框中的字体大小
@property(nullable, nonatomic, strong) UIFont * font ;
6.设置文本的中文字的对齐方式
@property(nonatomic) NSTextAlignment textAlignment;
7.设置文本框的输入风格是一个枚举
@property(nonatomic) UITextBorderStyle borderStyle;
8.通过字典设置默认字体的属性,这个属性设置后会影响到全部字体的属性
@property(nonatomic ,copy) NSDictionary<NSString*, id> * defaultTextAttributes;
9.设置文本款中默认状态下的字符
@property(nullable, nonatomic, copy) NSString * placeholder;
10.通过NSAttributedString设置文本款默认状态下的字符
@property(nullable, nonatomic, copy) NSAttributedString * attributedPlaceholder;
11.设置是否在编辑时清空文本框中的内容
@property(nonatomic) BOOL clearsOnBeginEditing;
12.设置文字是否适应文本框的宽度
@property(nonatomic) BOOL adjustsFontSizeToFitWidth;
13.设置最小的字体
@prperty(nonatomic) GCFolat minimumFontSize;
14.设置UITextField的代理方法
@property(nullable, nonatomic, weak) id<UITextFieldDelegate> delegate;
15.设置文本款的背景图片,图片会被拉伸
@property(nullable, nonatomic, strong) UIImage * background;
16.设置禁用时文本框的背景图片
@property(nullable, nonatomic, strong) UIImage * disableBackground;
17.设置文本框是否正在编辑,只读属性
@property(nonatomic, readonly, getter=isEditing) BOOL editing;
18.是否允许更改字符属性字典
@property(nonatomic) BOOL allowsEditingTextAttributes;
19.设置属性字典
@property(nullable, nonatomic, copy) NSDictionary<NSString*, id>*typingAttributes;
20.设置清除按钮的样式
@property(nonatomic) UITextFieldViewMode clearbuttonMode;
21.设置文本框左边的视图和视图的样式(一块设置才有效果)
@property(nullable, nonatomic, string) UIView * leftView
@Property(nonatomic) UITextFieldViewMode leftViewMode;
22.设置文本框右边的视图和视图的样式( 是枚举)
@property(nullable, nonatomic, string) UIView * rightView
@Property(nonatomic) UITextFieldViewMode rightViewMode;
23.(??????)通过重写这几个方法可以改变相应视图的位置
24.(????)这两个视图还有疑问,没有使用过
25.设置输入框成为第一响应者时弹出的视图和辅助视图(类似键盘)
@property(nullable, readwrite, strong) UIView * inputView;
@property(nullable, readwrite, strong) UIView * inputAccessoryView;(accessory附件);
26.是否允许再次编辑是可以在内容中间插入内容
@property(nonatmoic) BOOL clerasOnInsertion;
27.注销第一响应(收键盘可以???????)
- (BOOL)endEditing : (BOOL) force;
28.代理方法
@protocol UITextFieldDelegate <NSObject>
@optional
29.开始编辑时候调用的方法
- (BOOL) textFieldShouldBeginEditing : (UITextField*) textField;
30.已经结束时将要调用的方法
- (void) textFieldDidBeginEditind : (UITextField*) textField;
31.将要结束编辑时调用的方法,YES可以结束编辑,NO不能够结束编辑
- (BOOL) textFieldShouldEndEditing : (UITextField*) textField;
32.结束编辑时调用的方法
- (void) textFieldDidEndEditing : (UITextField*) textField;
33.输入字符是=时候调用的方法
- (BooL) textField : (UITextField*) textField shouldChangeCharactersInRange : (NSRange)range repolacementString : (NSString*) string;
34.点击清除时调用的方法,YES可以清除 NO不可以清除
- (BOOL) textFieldShouldClear:(UITextField*) textField;
35.点击return时候触发的方法
- (BOOL) textFieldShouldReturn: (UITextField*) textField;
相关文章推荐
- GUI - Web前端开发框架
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 评价ui设计作品好坏的八个标准(界面/交互设计研究)
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- 为Yahoo! UI Extensions Grid增加内置的可编辑器
- Cocos2d-x UI开发之文本类使用实例
- 谈谈对jquery ui tabs 的理解
- 在IE 浏览器中使用 jquery的fadeIn() 效果 英文字符字体加粗
- UI Events 用户界面事件
- jquery UI Datepicker时间控件的使用方法(基础版)
- Hallo.js基于jQuery UI所见即所得的Web编辑器
- 基于jQuery UI CSS Framework开发Widget的经验
- jquery ui 1.7 ui.tabs 动态添加与关闭(按钮关闭+双击关闭)
- jQuery UI设置固定日期选择特效代码分享
- Jquery ajax 同步阻塞引起的UI线程阻塞问题