I have created an outlet collection for several buttons , now I need change the background of the buttons , here is my code but compiler gives me an error :
[outlet makeObjectsPerformSelector:@selector(setBackgroundImage:img forState:UIControlStateSelected)];
Error :
Expected ‘:’
how can I solve it ?
EDITED :
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 50)];
imgView.image = [UIImage imageNamed:@"mask.png"];
[outlet makeObjectsPerformSelector:@selector(setBackgroundImage:)withObject:imgView];
[imgView release];
You can’t put arguments in
@selector(...). You need to usemakeObjectsPerformSelector:withObject:, e.g. your code should be something likeI say something like because I don’t think there’s a way to do this for a selector that takes more than one argument.