Disabling User Interaction with a segmented control?

会有一股神秘感。 提交于 2019-12-07 18:37:35

问题


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?


回答1:


Yes, the enabled property is what you want. You can also use userInteractionEnabled as well, but I think that enabled will suffice.




回答2:


Yes, for example. You can also use [segmentedControl setUserInteractionEnabled:NO]




回答3:


In swift 4.2

set yourSegmentedControlName.isUserInteractionEnabled = false




回答4:


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



来源:https://stackoverflow.com/questions/4888937/disabling-user-interaction-with-a-segmented-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!