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
if you have a standard UISegmentedControl you can use the following idea:
[_segmentedControl.subviews enumerateObjectsUsingBlock:^(UIView * obj, NSUInteger idx, BOOL *stop) {
[obj.subviews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[UILabel class]]) {
UILabel *_tempLabel = (UILabel *)obj;
[_tempLabel setNumberOfLines:0];
}
}];
}];
you may need to set the height of your instance as well.
NOTE: I need to add a little warning about – as rmaddy has also pointed out correctly – this is a quite fragile solution, because if the segmented control's view hierarchy would be changed in the future iOS versions that code may not work properly anymore.