user1872249 user1872249 - 7 days ago 6
iOS Question

What's the difference between UIControlStateHighlighted and UIControlStateSelected?

I am trying to set a state for UIButton.

But i don't know the difference between the

UIControlStateHighlighted
and
UIControlStateSelected
.

Could anyone help me out?

Thanks and best regards.

Answer

They can mean whatever you want them to, but in general they mean the following:

Highlighted = The user is currently interacting with something that will change once they stop interacting (e.g. holding down a button)

Selected = The item is current the active item in a group (e.g. The selected item in a segmented control). This can only be achieved by setting it programmatically.