3

My question is simple: I am creating a UIButton with resources for normal, disabled, selected and highlighted, in other words, all the controls I have access to. The problem is that, if for some reason I choose to set the button to be selected, and afterwards I tap on it, none of the resources I've set is shown.

setSelected = YES Correct resource setHightlighted = YES Correct resource setNormal = YES Correct resource etc.

I've verified all the resources and everything is in order. I'm not changing the state of the button in an IBAction, so that is not the case here.

Again, the weird appearance happens when the button is selected and I tap on it (like a highlight version of the selected state - if that makes any sense). How do I have access to this part? Or what do I have to do for this not to happen

4

1 回答 1

3

This part cannot be set in the xib file, but you have access to it by giving him a resource for the (Highlighted|Selected) state in the code.

[button setImage:image forState:UIControlStateHighlighted|UIControlStateSelected];

It's also a duplicate of : UIButton: set image for selected-highlighted state

于 2013-07-25T13:59:45.173 回答