File tree Expand file tree Collapse file tree
TOSegmentedControl/Private Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ - (UILabel *)makeLabelForTitle:(NSString *)title
210210 label.text = title;
211211 label.textAlignment = NSTextAlignmentCenter;
212212 label.textColor = self.segmentedControl .itemColor ;
213+ label.font = self.segmentedControl .selectedTextFont ;
214+ [label sizeToFit ]; // Size to the selected font
213215 label.font = self.segmentedControl .textFont ;
214216 label.backgroundColor = [UIColor clearColor ];
215217 return label;
@@ -264,6 +266,11 @@ - (void)refreshItemView
264266
265267 // Update the label view
266268 label.textColor = self.segmentedControl .itemColor ;
269+ // Set the frame off the selected text as it is larger
270+ label.font = self.segmentedControl .selectedTextFont ;
271+ [label sizeToFit ];
272+
273+ // Set back to default font
267274 label.font = self.segmentedControl .textFont ;
268275
269276 // Update the image view
You can’t perform that action at this time.
0 commit comments