My code so far;
UISegmentedControl *segment = [[UISegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 200, 45)];
[segment insertSegmentWithTitle:@"OPEN THE DOOR" atIndex:0 animated:NO];
I have 3 segments in the segment controller, open the door,no & . . I need to adjust the width of each segment based on the its title.
for example open the door requires more width and no requires a little. the . requires very little that the other 2 segments.
I tried [segment setWidth:200 forSegmentAtIndex:0]; to increase the width but it didn’t work. How can i do this ?
If you are using iOS 5 try using the
apportionsSegmentWidthsByContentproperty so simply set(and get rid of your existing code to set widths)