UI基础控件(二)-------- UITextField
来源:互联网 发布:淘宝商城男装裤子 编辑:程序博客网 时间:2024/04/30 07:50
UITextField
一.常用属性
1.文字属性:
文字属性包括: text;placeholder(默认使用70%灰色);font;textColor;textAligment。
2.文字大小:
文字大小包括: adjustsFontSizeToFitWidth;minimumFontSize。
3.编辑行为:
编辑行为包括: editing;clearsOnBeginEditing。
4.展现形态:
展现形态包括:borderStyle(默认 UITextBorderStyleNone,是 UITextBorderStyleRoundedRect 时自定义的 background 无效);background;disabledBackground property(background 未设置时,这个会无效)
5.覆盖视图
覆盖视图包括:clearButtonMode;leftView(像 clearButton 那样的视图,不过在左边,不要忘了设置 mode);leftViewMode;rightView;rightViewMode。
6.访问代理
方为代理包括: delegate
7.绘画界面
以下都不应该直接调用,需要的话可以重写:
(1)-textRectForBounds:重写来重置文字区域;
(2)-drawTextRect:改变文字属性,重写时调用 super 可以按默认图形属性绘制,若自己完全重写绘制函数,就不用调用 super 了。
(3)-placehoderRectForBounds:重写来重置占位符区域;
(4)-drawPlaceholderInRect:重写改变绘制占位符属性,重写时调用 super 可以按默认图形属性绘制,若自己完全重写绘制函数,就不用调用 super 了;
(5)-borderRectForBounds:重写来重置边缘区域;
(6)-editingRectForBounds:重写来重置编辑区域;
(7)-clearButtonRectForBounds:重写来重置clearButton位置,改变 size 可能导致 Button 图片失真;
(8)-leftViewRectForBounds:左方
(9)-rightViewRectForBounds:右方
8.代替输入
(1)inputView:代替标准的系统键盘;
(2)inputAccessoryView:编辑时显示在系统键盘火用户自定义的inputView上面的视图。
二。初始化UITextField
初始化UITextField控件显示在屏幕上
UITextField * aTextField = [[UITextField alloc] initWithFrame:CGRectMake(100,100,100,50)];aTextField.borderStyle = UITextBorderStyleRoundedRect;[aTextField setText:@"Hello!"];[self.view addsubview: aTextField];[aTextField release];
- UI基础控件(二)-------- UITextField
- UI基础控件系列---->UITextField
- 【Android基础】(8)UI控件(二)
- UI控件-UITextField
- UI基本控件---UITextField
- iOS-UI-基础控件核心API-UITextField&UIButton
- UI基础学习之(三):UITextField
- UI基础:UITextField
- UI基础_UITextView/UITextField
- UI控件笔记(四):UI之UITextField的属性
- iOS基础控件---UITextField
- iOS基础——UI控件之UIView、UITextField、UILabel、UIColor、UIButton、UIImageView
- UI基础控件(一)
- iOS开发基础控件--UITextField
- UI控件详解06-UITextField 详解
- UI基本控件-UILabel-UITextField-UIButton-UIAlertView
- objective-c-UI控件之-UITextField-placeholder
- objective-c-UI控件之-UITextField-clearButtonMode
- C++ type deduct summary
- android的消息处理机制(图+源码分析)——Looper,Handler,Message
- 异步复制和同步复制
- 100个 Linux命令
- C# 自定义控件绘图 未处理 System.AccessViolationException异常
- UI基础控件(二)-------- UITextField
- 支撑4.5亿活跃用户的WhatsApp架构概览
- 关于“无状态的HTTP连接提供有状态的连接”
- hive 中的多列进行group by查询方法
- JAVA中堆栈和内存分配原理
- 搜索标签切换 属性 要访问的url
- 面试问题总结
- 【git】 创建一个新分支
- 解决IE版本兼容问题