I have a relative longer text items in my segmented control so I need to break text at certain points. Is it possible to use line breaks? I know at buttons
Add [yourSegmentedControl layoutIfNeeded];
method, before adding it as a subview. Then iterate all the SegmentedControl subviews and modify the numberOfLines
property of the title label.
Here is the code
for (id segmentItem in [yourSegmentedControl subviews])
{
if ([segmentItem isKindOfClass:[UILabel class]])
{
UILabel *titleLabel = (UILabel *) segmentItem;
titleLabel.frame = CGRectMake(0, 0, 100, 50); //modify the frame if the second line is not showing.
titleLabel.numberOfLines = 0;
}
}