daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Sep 12th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Easier way to change all the buttons?
  2. b1.backgroundColor = [UIColor redColor];
  3. b2.backgroundColor = [UIColor redColor];
  4. b3.backgroundColor = [UIColor redColor];
  5. b4.backgroundColor = [UIColor redColor];
  6. b5.backgroundColor = [UIColor redColor];
  7. b6.backgroundColor = [UIColor redColor];
  8. b7.backgroundColor = [UIColor redColor];
  9. b8.backgroundColor = [UIColor redColor];
  10. b9.backgroundColor = [UIColor redColor];
  11. b10.backgroundColor = [UIColor redColor];
  12.    
  13. //Make an array of the buttons:
  14. NSArray* buttons=[[NSArray alloc] initWithObjects:b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,nil];
  15. //Loop through them
  16. for(UIButton* b in buttons)
  17. {
  18.   b.backgroundColor = [UIColor redColor];
  19. }
  20.    
  21. NSArray* buttonArray=[[NSArray alloc] initWithObjects:b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,nil];
  22.    
  23. [buttonArray makeObjectsPerformSelector:@selector(setBackgroundColor:) withObject:[UIColor redColor]];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top