ghiboz
ghiboz

Reputation: 8003

ios uisegmentedcontrol with different sizes

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

Upvotes: 4

Views: 3943

Answers (3)

Stan
Stan

Reputation: 1583

Try this code it helped me:

segmentedControl.apportionsSegmentWidthsByContent = true

Upvotes: 3

Borut Tomazin
Borut Tomazin

Reputation: 8138

This sure works:

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

Upvotes: 5

IssamTP
IssamTP

Reputation: 2440

Try with:

[yourSegmentedController widthForSegmentAtIndex:indexOfSegmentYouWantToChange];

Hope it helps.

EDIT:

Can be better to do:

[yourSegmentedController sizeToFit];

Upvotes: 2

Related Questions