Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change width of a segmented control based on titles in each segment?

Starts like this, which I like:
Screenshot1.png

But then I add a segment and this happens:
Screenshot2.png The width is set in IB, not in code.

All I need is a method to calculate width on the fly. At the end, it would do something like this:

control.width = (labelWidths + marginWidths);
// where marginWidths = (marginWidth * control.numberOfSegments)
like image 270
Thromordyn Avatar asked Aug 16 '12 15:08

Thromordyn


1 Answers

You can use the propertyapportionsSegmentWidthsByContent and set it toYES.

like image 166
Rajesh Avatar answered Oct 21 '22 09:10

Rajesh