I just have a quick question.
I'm writing a tic tac toe game for the heck of it (practice, I guess) and I want to make it so that when a player gets three in a row, it highlights the three buttons in some color. I can get the center rectangle of the buttons to change color but I can't get the entire button to change color like for example when you click on it. Here:
See? I'd like the buttons to nicely highlight the entire button but what they do now is just a rectangle in the middle and ignore the parts on the left and right. Note the buttons are just normal UIButtons (RoundRectButtons) created and placed in the view through code. Here's the code I used to do the highlighting:
Any ideas would be appreciated. Thanks!
I'm writing a tic tac toe game for the heck of it (practice, I guess) and I want to make it so that when a player gets three in a row, it highlights the three buttons in some color. I can get the center rectangle of the buttons to change color but I can't get the entire button to change color like for example when you click on it. Here:
See? I'd like the buttons to nicely highlight the entire button but what they do now is just a rectangle in the middle and ignore the parts on the left and right. Note the buttons are just normal UIButtons (RoundRectButtons) created and placed in the view through code. Here's the code I used to do the highlighting:
Code:
- (void)highlightSpaces:(int)one second:(int)two third:(int)three {
if (one<9 && two<9 && three<9) {
//Note the 9 tic tac toe buttons are contained in one NSMutableArray
[[[buttonsArray objectAtIndex:one] titleLabel] setBackgroundColor:[UIColor greenColor]];
[[[buttonsArray objectAtIndex:two] titleLabel] setBackgroundColor:[UIColor greenColor]];
[[[buttonsArray objectAtIndex:three] titleLabel] setBackgroundColor:[UIColor greenColor]];
}
}
Any ideas would be appreciated. Thanks!