Skip to content

Instantly share code, notes, and snippets.

@abrahamvegh
Created January 16, 2011 02:00
Show Gist options
  • Save abrahamvegh/781470 to your computer and use it in GitHub Desktop.
Save abrahamvegh/781470 to your computer and use it in GitHub Desktop.
If there’s a better way to do this, I’ll eat my code.
- (BOOL) textField: (UITextField *) textField shouldChangeCharactersInRange: (NSRange) range replacementString: (NSString *) string
{
([(textField == self.serverField ? self.emailField : self.serverField).text length] > 0 &&
[(textField == self.passwordField ? self.emailField : self.passwordField).text length] > 0 &&
[[textField.text stringByReplacingCharactersInRange: range withString: string] length] > 0
) ? (self.navigationItem.rightBarButtonItem.enabled = YES) : (self.navigationItem.rightBarButtonItem.enabled = NO) ;
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment