ios - Apply auto-layout to UISegmentedControl -


i set custom widths segments in uisegmentedcontrol. because of that, segmentedcontrol doesn't use auto-layout. (in storyboard, applied constraint on 4 sides of segmentedcontrol.)

here code:

cgfloat segmentwidth = self.segment.frame.size.width;  [self.segment insertsegmentwithtitle:@"titlename" atindex:2 animated:no];     [self.segment setwidth:segmentwidth / 6 forsegmentatindex:1]; [self.segment setwidth:segmentwidth / 6 forsegmentatindex:2];  [self.segment setwidth:segmentwidth / 3 forsegmentatindex:0]; 

here's image illustrate code does:

enter image description here

is there way add auto-layout segments?

the problem code in wrong place. put in viewdidlayoutsubviews , well.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -