- (void)textFieldChanged:(UITextField*)textField{ //空格解决方案 NSString *_string = textField.text; NSRange _range = [_string rangeOfString:@" "]; if (_range.location != NSNotFound) { //有空格 NSLog(@"密码中不能包含空格"); textField.text = [NSString stringWithFormat:@"%@",[textField.text substringToIndex:textField.text.length - 1]]; } }
UITextField检测输入内容不能有空格的处理
猜你喜欢
转载自www.cnblogs.com/zk1947/p/9443748.html
今日推荐
周排行