UITextField

来源:互联网 发布:电脑定闹钟软件 编辑:程序博客网 时间:2024/05/17 06:18
 当用户开始编辑一个文本框的时候,首先会调用这个,看是否允许编辑这个文本框- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{    return NO;} 当用户结束编辑一个文本框的时候,首先会调用这个,看是否允许结束编辑这个文本框- (BOOL)textFieldShouldEndEditing:(UITextField *)textField{    return NO;} 当用户输入文字之前,会调用这个方法,判断是否允许把这个文字输入到文本框上面- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{    NSLog(@"shouldChangeCharactersInRange--%@",textField.text);    return YES;//} // 是否允许编辑 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;  // - (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder // 是否允许结束编辑 - (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end - (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called // 是否允许用户输入文件 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text  - (BOOL)textFieldShouldClear:(UITextField *)textField;


0 0
原创粉丝点击