I have a UISegmentedControl in a UIView in my popover that I want to disable in some cases. A segmented control is configured using the Interface Builder in the nib file. Checked IB checkbook "Enabled".
To disable it, I wrote:
self.segmentedControl.enabled = NO; // or YES when I want it enabled
What works to such an extent that from there on a segmented control does not respond to touch events.
However, there is no graphical feedback. I would like the segmented control to be dim (gray) when it is disabled. I tried to set its highlighted property to NO , but with no effect.
This should be possible, since disabling the UISegmentedControl using Interface Builder causes the dimming effect that I want.
However, if I do this, my code will not be able to enable it again:
self.segmentedControl.enabled = YES;
won't turn it on: even if he starts to accept touch events again, he will remain dull.
As if IB "enabled" checkbox controls two properties: enabled and dimmed . But what is this dimmed property that I cannot find?
What did I miss?
This is in the 4.3 iPad simulator.
(note that I'm talking about the whole control, and not about its individual segments).
Edit:. I did a bit of research, and I found that disabling a segmented control in IB also sets its alpha property to 0.5.
When adding:
self.segmentedControl.alpha = 0.5; // or 1.0 if enabled
Now my application looks fine.
Am I right in thinking that setting the enabled property should also take care of the look of the screen?