类说明
CATextField的数据代理
CATextFieldDelegate 方法(点击查看方法介绍)
| 方法 | 说明 |
| textFieldShouldBeginEditing | 开始编辑时触发 |
| textFieldShouldEndEditing | 结束编辑时触发 |
| textFieldShouldReturn | 返回时触发 |
| keyBoardHeight | 键盘高度 |
| textFieldShouldChangeCharacters | 文字更改后触发 |
CATextFieldDelegate 方法说明
virtual bool textFieldShouldBeginEditing(CATextField * sender)
返回值:bool
参数:
| 类型 | 参数名 | 说明 |
| CATextField* | sender | 当前textField |
解释:开始编辑时触发
virtual bool textFieldShouldEndEditing(CATextField * sender)
返回值:bool
参数:
| 类型 | 参数名 | 说明 |
| CATextField* | sender | 当前textField |
解释:结束编辑时触发(如果发件人不想从时间中分离,返回true)
virtual void textFieldShouldReturn(CATextField *sender){}
返回值:void
参数:
| 类型 | 参数名 | 说明 |
| CATextField* | sender | 当前textField |
解释:返回时触发
virtual void keyBoardHeight(CATextField *sender, int height){}
返回值:void
参数:
| 类型 | 参数名 | 说明 |
| CATextField* | sender | 当前textField |
| int | height | 高度 |
解释:键盘高度
virtual bool textFieldShouldChangeCharacters(CATextField* sender, unsigned int location, unsigned int lenght, const std::string& changedText);
返回值:bool
参数:
| 类型 | 参数名 | 说明 |
| CATextField* | sender | 当前textField |
| unsigned int | location | 光标选中的字符串,即被替换的字符串 |
| unsigned int | lenght | length为0时,表示删除 |
| const std::string& | changedText | 更改文本时Text内容 |
解释:textField文字更改后触发(返回true表示修改生效,返回false表示不做修改,textField的内容不变)