views:

68

answers:

1

The three other UIControlStates are clear to me, but I cannot understand the purpose of UIControlStateSelected. What/when does a UIControl subclass enter this state?

+1  A: 

In the instance that a button, etc. is selected or pressed. A lot of people use that particular one to change images on the object to show a selected state for the brief moment when it is selected.

I have also used it in tables to make it easier to re-use cells by checking for selected states and updating the table cell based on if it's selected or not.

iWasRobbed
But what does 'selected' mean? If I understand correctly, on touchdown, a button goes into highlighted state, and selected is never triggered in normal use.
hyn
Think of it as toggling a button and making it continue to be pressed down. Like in the instance that you press the "Repeat" button on your music player and it stays "selected" so each song will repeat as long as that button is in a selected state.
iWasRobbed
Ah, so it's a state reserved for toggle style controls.
hyn