Tuesday, May 31, 2011

Validating UITextView For Minimum Text Length

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{

if (([text length] == 0)&& ([textView.text length] ==1))
{
self.sendButton.enabled = NO;
}
else if ([text length] == 1)
{
self.sendButton.enabled = YES;
}

return YES;
}

No comments:

Post a Comment