4

I wish use a uisegmentedcontrol in my app with 3 segments but not with the same size, the first and the third smaller than the second... is this possible? how can I do this? thanks

ghiboz
  • 7,863
  • 21
  • 85
  • 131

3 Answers3

5

This sure works:

[self.mySegmentedControl setWidth:30.f forSegmentAtIndex:0];
Borut Tomazin
  • 8,041
  • 11
  • 78
  • 91
3

Try this code it helped me:

segmentedControl.apportionsSegmentWidthsByContent = true
Stan
  • 1,513
  • 20
  • 27
2

Try with:

[yourSegmentedController widthForSegmentAtIndex:indexOfSegmentYouWantToChange];

Hope it helps.

EDIT:

Can be better to do:

[yourSegmentedController sizeToFit];
IssamTP
  • 2,408
  • 1
  • 25
  • 48