- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if(textField == aText)
{
if ([string isEqualToString:@"&"] || [string isEqualToString:@" "] )
{
return NO;
}
}
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if(textField == TextField)
{
if ([string length] == 0 && range.length > 0)
{
TextField.text = [TextField.text stringByReplacingCharactersInRange:range withString:string];
return NO;
}
NSCharacterSet *nonNumberSet = [[NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"] invertedSet];
if ([string stringByTrimmingCharactersInSet:nonNumberSet].length > 0)
{
return YES;
}
else
{
return NO;
}
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if(textView == YourReview1)
{
if ([text isEqualToString:@"&"]||[text isEqualToString:@" "])
{
return NO;
}
return YES;
}
}
No comments:
Post a Comment