This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
NSString *currentStr; | |
if ((range.length == 0 && string.length > 0) || (range.length > 0 && string.length > 0)) { | |
// add the characters to textfield | |
NSString *firstHalfStr = [textField.text substringToIndex:range.location]; | |
NSString *lastHalfStr = [textField.text substringFromIndex:(range.location + range.length)]; | |
currentStr = [NSString stringWithFormat:@"%@%@%@",firstHalfStr,string,lastHalfStr]; |
NewerOlder