Reputation: 1890
When I type two or more consecutive space chars into an iPhone/iPad textfield, iOS adds a '.' char at the end of the last typed word, which is something I don't usually want. I think I've disabled all kind of "automatic correction controls" for my textfields inside Interface Builder, but no luck.
Upvotes: 0
Views: 341
Reputation: 11
In this method:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)
instead of return YES do this:
return !(range.location > 0 &&
[string length] > 0 &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]]);
}
Upvotes: 1