SMSegmentView
SMSegmentView copied to clipboard
Add Auto Layout to SMSegment
At the moment SMSegment does not support custom onSelectionFontColor even though it is declared.
This commit adds support for it. However, in order to make it work, several changes needed to be made to support auto layout instead of manual label/image sizing. In the later case the following case was problematic:
- Segment is loaded with some default title and regular font
- It is selected and the font is changed to bold
The result was often that the frame size would not update properly and hence the label was kept the same size as before. However, as the same text cannot fit in such a space with bold font only "..." would appear.
Adding auto layout resolves this issue.
Some things I would like to point:
- This commit does not handle the case if the label is too wide. Although it is very easy to add this support by specifying few extra constraints
- I have tested it on segments with titles only and it works really well.