当前位置:K88软件开发文章中心编程语言APP编程CrossApp → 文章内容

CATextField(输入框)

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-23 13:52:12

由 ?﹏???ζ???﹏﹏? 创建, 最后一次修改 2016-09-07 类说明CATextField是单行输入框控件。主要接收用户的文本输入,多用于用户名、密码、聊天输入等。CATextField 属性(点击查看方法介绍)属性说明Delegate数据代理ClearButtonMode添加按钮模式MarginLeft左边缘MarginRight右边缘FontSize字体大小PlaceHolderTextPlaceHolder文本内容PlaceHolderColorPlaceHolder文本内容颜色Text文本内容TextColor文本内容颜色KeyboardType键盘类型ReturnTypeReturn键类型TextFieldAlignTextField的对齐方式SecureTextEntry设置TextField为密码输入框AllowkeyBoardHide返回键恢复键盘MaxLenght最大长度CATextField 方法(点击查看方法介绍)方法说明resignFirstResponder隐藏键盘第一响应者状态becomeFirstResponder弹出键盘第一响应者状态createWithFrame创建,并指定其FramecreateWithCenter创建,并设置其Centerinit初始化setMarginImageLeft设置左边缘图像setMarginImageRight设置右边缘图像setBackgroundImage设置背景图像CATextField 属性说明Delegate类型:CATextFieldDelegate*解释:数据代理,set/get{}。ClearButtonMode类型:ClearButtonMode解释:添加按钮模式,set/get{}。typedef enum{ None = 0, //正常模式,不添加按钮 WhileEditing //添加清除按钮}ClearButtonMode;MarginLeft类型:int解释:左边缘(如果选择默认:左16,右16),set/get{}。MarginRight类型:int解释:右边缘(如果选择默认:左16,右16),set/get{}。FontSize类型:int解释:字体大小,set/get{}。PlaceHolderText类型:std::string解释:PlaceHolder文本内容,set/get{}。PlaceHolderColor类型:CAColor4B解释:PlaceHolder文本内容颜色,set/get{}。Text类型:std::string解释:文本内容,set/get{}。TextColor类型:CAColor4B解释:文本内容颜色,set/get{}。KeyboardType类型:KeyboardType解释:键盘类型,set/get{}。(默认为KeyboardTypeDefault类型)typedef enum{ Default = 0, NumbersAndPunctuation, URL, NumberPad, PhonePad, NamePhonePad, EmailAddress,}KeyboardType;ReturnType类型:ReturnType解释:Return键类型,set/get{}。(默认ReturnTypeDone类型)typedef enum{ Done=0, Go, Next, Search, Send}ReturnType;TextFieldAlign类型:TextFieldAlign解释:TextField的对齐方式,set/get{}。(默认:中心)typedef enum { Left, Center, Right}TextFieldAlign;SecureTextEntry类型:bool解释:设置TextField为密码输入框,is/set{}。(密码输入框,默认为假)AllowkeyBoardHide类型:bool解释:返回键恢复键盘,is/set{}。(返回键恢复键盘,默认为真)MaxLenght类型:int解释:最大长度,set/get{}。CATextField 方法说明virtual bool resignFirstResponder();返回值:bool参数:解释:隐藏键盘第一响应者状态virtual bool becomeFirstResponder();返回值:bool参数:解释:弹出键盘第一响应者状态static CATextField* createWithFrame(const DRect& frame);返回值:CATextField*参数:类型参数名说明const DRect&frame区域大小解释:创建,并指定其Framestatic CATextField* createWithCenter(const DRect& rect);返回值:CATextField*参数:类型参数名说明const DRect&rect中心点的位置及大小解释:创建,并设置其Centerbool init();返回值:bool参数:解释:初始化void setMarginImageLeft(const DSize& imgSize,const std::string& filePath);返回值:void参数:类型参数名说明const DSize&imgSize图像大小const std::string& filePath图像路径解释:设置左边缘图像void setMarginImageRight(const DSize& imgSize,const std::string& filePath);返回值:void参数:类型参数名说明const DSize&imgSize图像大小const std::string& filePath图像路径解释:设置右边缘图像void setBackgroundImage(CAImage* image);返回值:void参数:类型参数名说明CAImage*image图像解释:设置背景图像

CATextField(输入框)