Reputation: 1
I need to make it not allow write many 0's if before 0 is nothing. Is there any method of textfield?
Upvotes: 0
Views: 76
Reputation: 342
Modify this sample code as per your requirement.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([string isEqualToString:@" "]) // Preventing Spaces here {
return NO;
}
else{
return YES;
}
}
Upvotes: 1