Search code examples
objective-cxcodeuisegmentedcontrol

Change UISegmentedControl titles programmatically


How can i change UISegmentedControl titles programmatically? Could you please help me?

@synthesize filterControl; //UISegmentedControl

- (void)viewDidLoad
{
    [super viewDidLoad];

    filterControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"ALL",@"PROFIT",@"LOSS", nil]]; //not working

}

Solution

  • Have u added filterControl as subview to its superview?