Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Easier way to change all the buttons?
- b1.backgroundColor = [UIColor redColor];
- b2.backgroundColor = [UIColor redColor];
- b3.backgroundColor = [UIColor redColor];
- b4.backgroundColor = [UIColor redColor];
- b5.backgroundColor = [UIColor redColor];
- b6.backgroundColor = [UIColor redColor];
- b7.backgroundColor = [UIColor redColor];
- b8.backgroundColor = [UIColor redColor];
- b9.backgroundColor = [UIColor redColor];
- b10.backgroundColor = [UIColor redColor];
- //Make an array of the buttons:
- NSArray* buttons=[[NSArray alloc] initWithObjects:b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,nil];
- //Loop through them
- for(UIButton* b in buttons)
- {
- b.backgroundColor = [UIColor redColor];
- }
- NSArray* buttonArray=[[NSArray alloc] initWithObjects:b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,nil];
- [buttonArray makeObjectsPerformSelector:@selector(setBackgroundColor:) withObject:[UIColor redColor]];
Add Comment
Please, Sign In to add comment