Guest User

Untitled

a guest
Dec 14th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. NSArray *textFields = @[self.emailTextField, self.nameTextField, self.firstNameTextField ... etc];
  2. for (UITextField *textField in textFields) {
  3. textField.backgroundColor = [UIColor redColor];
  4. }
  5.  
  6. @interface MyViewController : UIViewController
  7.  
  8. @property (nonatomic, strong) IBOutletCollection(UITextField) NSArray *textFields;
  9.  
  10. @end
  11.  
  12. for (UITextField *textField in self.view.subviews) {
  13. if ([textField isKindOfClass:[UITextField class]]) {
  14. textField.backgroundColor = [UIColor exampleColor];
  15. }
  16. }
  17.  
  18. NSArray *array = @[emailField, nameField, etc...]
  19. for (UITextField *textField in array)
  20. textField.backgroundColor = [UIColor exampleColor];
  21. }
Add Comment
Please, Sign In to add comment