I want to enable and disable user interaction with a UISegmented Control. I noticed that its superclass UIControl has a property called "enabled" is this what I need to set in order to disable/enable my control?
Asked
Active
Viewed 3,762 times
2
-
yeah I just tried it and it work perfectly. Thanks for the quick reply! – Christian Gossain Feb 03 '11 at 17:04
4 Answers
7
Yes, the enabled property is what you want. You can also use userInteractionEnabled as well, but I think that enabled will suffice.
Jacob Relkin
- 161,348
- 33
- 346
- 320
-
2I found that `enabled` alone isn't enough. A disabled segmented control will still receive touches and change its segment. It needs the `userInteractionEnabled` set to `NO` too. – nevan king Jun 21 '13 at 18:55
6
Yes, for example. You can also use [segmentedControl setUserInteractionEnabled:NO]
Björn Marschollek
- 9,899
- 9
- 40
- 66
0
Upon tapping a segment I was making a network call and during the network call I wanted to disable the segment and also have it greyed out a bit.
Using isUserInteractionEnabled will only disable/enable the segment.
But using isEnabled will gray add a gray overlay in addition to disabling/enabling the segment.
So for me isEnabled was a better alternative
mfaani
- 33,269
- 19
- 164
- 293