Reputation: 5972
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?
Upvotes: 2
Views: 3935
Reputation: 36287
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 and add a gray overlay in addition to disabling/enabling the segment.
So for me isEnabled
was a better alternative
Upvotes: 1
Reputation: 702
In swift 4.2
set yourSegmentedControlName.isUserInteractionEnabled = false
Upvotes: 1
Reputation: 163238
Yes, the enabled
property is what you want. You can also use userInteractionEnabled
as well, but I think that enabled
will suffice.
Upvotes: 7
Reputation: 9999
Yes, for example. You can also use [segmentedControl setUserInteractionEnabled:NO]
Upvotes: 6