UISegmentedControl change number of segments programmatically

Beppino66 picture Beppino66 · Jul 24, 2012 · Viewed 46.8k times · Source

Is there a way to change the number of segments programmatically?

Answer

Scar picture Scar · Jul 24, 2012

Yes, you can use

removeSegmentAtIndex:(NSUInteger) animated:(BOOL)

And

insertSegmentWithTitle:(NSString *) atIndex:(NSUInteger) animated:(BOOL)