Created
July 9, 2011 22:08
-
-
Save chrishulbert/1073995 to your computer and use it in GitHub Desktop.
Trim whitespaces on all text fields in a view controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Trim them | |
| for (UIView* v in self.view.subviews) { | |
| if ([v isKindOfClass:[UITextField class]]) { | |
| UITextField* tf = (id)v; | |
| tf.text = [tf.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment