0

I have many controls like, image views, labels (UIControls), which have I wish to show like a dual mode controls. i.e. Based on my data, I have to set them either with image 1 or image 2 (for a image view), similarly with the label. I tried accomplishing this using the highlighted state properties of image view and labels. For the image view, I gave one image reference for highlighted and another for normal.

however when I programmatically set the highlighted property to yes, they are not toggling between them. Is there something I'm missing?

user7388
  • 1,741
  • 2
  • 19
  • 25
Ravi Vooda
  • 5,216
  • 5
  • 19
  • 25

3 Answers3

0

Use selected state instead. I think highlighted state is a transient state.

sixthcent
  • 1,150
  • 7
  • 6
0

From the documentation:

Highlighted state of a control. A control enters this state when a touch enters and exits during tracking and when there is a touch up event. You can retrieve and set this value through the highlighted property.

So, you don't set the highlighted property. Try setSelected.

Have you seen this related topic: Highlighting a UIControl subclass?

Community
  • 1
  • 1
Jean
  • 7,623
  • 6
  • 43
  • 58
0

Try this out:

if([imgeview isselected]){

[imageview setselected:NO];

}else{

[imageview setselected:YES];

}

kalyan
  • 13
  • 3