文本输入控件

 UITextField视图


  作用:用户输入文字




常用属性


// 设置和获取文本内容,默认nil
@property(nonatomic,copy)   NSString                  *text;


// 设置文本内容颜色
@property(nonatomic,retain) UIColor                   *textColor;


// 设置字体
@property(nonatomic,retain) UIFont                    *font


// 对齐样式
@property(nonatomic)         NSTextAlignment          textAlignment;


// 设置风格,默认没有风格,需要设置
@property(nonatomic)         UITextBorderStyle        borderStyle;


// 提示用户输入内容文本
@property(nonatomic,copy)   NSString                  *placeholder;


// 用户编辑时是否clear内容,默认为NO
@property(nonatomic)                   BOOL             clearsOnBeginEditing;


// 自适应调整字体大小,默认为NO
@property(nonatomic)                   BOOL             adjustsFontSizeToFitWidth;








常用属性


// 设置代理
@property(nonatomic,assign) id<UITextFieldDelegate> delegate;


// 设置背景,需要将textField实例的风格设置为None
@property(nonatomic,retain) UIImage                   *background;


// 设置textField不可用时的背景图片
@property(nonatomic,retain) UIImage                   *disabledBackground;


// 设置是否可编辑
@property(nonatomic,readonly,getter=isEditing) BOOL editing;


// 清除按钮的模式,默认不出现
@property(nonatomic)         UITextFieldViewMode  clearButtonMode;


// 自定义左视图
@property(nonatomic,retain) UIView                *leftView;


// 自定义左视图出现的模式
@property(nonatomic)         UITextFieldViewMode  leftViewMode;


// 不用系统键盘,自定义键盘
@property (readwrite, retain) UIView *inputView;


// 系统键盘和自定义键盘共存
@property (readwrite, retain) UIView *inputAccessoryView;


// 自动大写类型
@property(nonatomic) UITextAutocapitalizationType autocapitalizationType;


// 检查拼写是否正确
@property(nonatomic) UITextAutocorrectionType autocorrectionType;


// 修改键盘类型
@property(nonatomic) UIKeyboardType keyboardType;


// 修改返回类型
@property(nonatomic) UIReturnKeyType returnKeyType;


// 是否安全输入,比如用户输入密码
@property(nonatomic,getter=isSecureTextEntry) BOOL secureTextEntry;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值