Ios uisegmentedcontrol with various sizes

I want to use uisegmentedcontrol in my application with 3 segments, but not the same size, the first and third are smaller than the second ... Is this possible? How can i do this? thank

+3
source share
3 answers

Try:

[yourSegmentedController widthForSegmentAtIndex:indexOfSegmentYouWantToChange];

Hope this helps.

EDIT:

Could be better:

[yourSegmentedController sizeToFit];
+2
source

It works:

[self.mySegmentedControl setWidth:30.f forSegmentAtIndex:0];
+5
source

Try this code that helped me:

segmentedControl.apportionsSegmentWidthsByContent = true
+1
source

Source: https://habr.com/ru/post/1787224/


All Articles