How to disable part of UISegmentedControl? How to disable part of UISegmentedControl? ios ios

How to disable part of UISegmentedControl?


Use setEnabled:forSegmentAtIndex: method to enable and disable the segments.

[segmentedControl setEnabled:NO forSegmentAtIndex:0];

if you want to disable the first segment.


For those who can be interested in the swift command:

Swift 2.3

segmentedControl.setEnabled(false , forSegmentAtIndex: 0);

Swift 3

self.segmentedControl.setEnabled(false, forSegmentAt: 0);