Replace " . " with space ----- if space is pressed twice, a full-stop gets appeared automatically ---- IOS
if ( (range.location > 0 && [string length] > 0 &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]]) )
{
//Manually replace the space with your own space, programmatically
textField.text = [textField.text stringByReplacingCharactersInRange:range withString:@" "];
//Tell Cocoa not to insert its space, because you've just inserted your own
return NO;
}
//User not enter after 1st space in UITextField --- ios
return !(range.location > 0 &&
[string length] > 0 &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]]);
if ( (range.location > 0 && [string length] > 0 &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]]) )
{
//Manually replace the space with your own space, programmatically
textField.text = [textField.text stringByReplacingCharactersInRange:range withString:@" "];
//Tell Cocoa not to insert its space, because you've just inserted your own
return NO;
}
//User not enter after 1st space in UITextField --- ios
return !(range.location > 0 &&
[string length] > 0 &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[string characterAtIndex:0]] &&
[[NSCharacterSet whitespaceCharacterSet] characterIsMember:[[textField text] characterAtIndex:range.location - 1]]);
No comments:
Post a Comment