Is there a way to change the number of segments programmatically?
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.