In my iPhone app, I have array of buttons that are dynamically generated based on user selection.
How do I distinguish selected button from others?
I want that when user select the other button the previously selected button should go back to its normal state in terms of its looks. I am unable to revert the previously selected buttons to its normal state.
You have an array of the buttons. You can loop through your array and check if it is the one that was clicked.
- (IBAction) buttonClicked:(id)sender {
for(int i; i < [array count]; i++){
if((UIButton *)sender == (UIButton *)[array objectAtIndex:i])
//do something
else
//do something else
}
Something like that.