
board[i] is an array of UIButtons that I have created programmmatically, and I can’t change their image for UIControlStateHighlighted:
[board[i] setImage:[UIImage imageNamed:@"block"] forState:UIControlStateNormal];
[board[i] setImage:[UIImage imageNamed:@"blockPressed"] forState:UIControlStateHighlighted];
When I press the button with the mouse in the simulator the image doesn’t change. I think this is a very noob question, but I don’t what the code doesn’t work.
when adding button programatically do this:
add target of each same.
provide tag all button from 0 to count.
set UserInteraction to true
setBackgroundImage:[UIImage imageNamed:@”blockPressed.png”] forState:UIControlStateHighlighted if u want button to be highlited
Now button is pressed same method is called for all button: For example