UISegmentedControl change number of segments programmatically
Yes, you can use
removeSegmentAtIndex:(NSUInteger) animated:(BOOL)
And
insertSegmentWithTitle:(NSString *) atIndex:(NSUInteger) animated:(BOOL)
To replace the segments entirely, you can use the following function:
- (void)setSegments:(NSArray *)segments
{
[segmentController removeAllSegments];
for (NSString *segment in segments) {
[segmentController insertSegmentWithTitle:segment atIndex:segmentController.numberOfSegments animated:NO];
}
}
Hope this helps.