TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jul 2017 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Eugene Shevtsov.
This control was created to solve issue, that native UISegmentedControl has. Reffer to SVSegmentedControl for obj-c version. UISegmentedControl has issue with apportionsSegmentWidthsByContent setting (adjust segments width proportionally to content). Often, it appears that control bounds are wider, than actual segments width. See screenshot bellow - I put yellow color as layer background.
With SVSegmentedControl issue is fixed and same segmented control will look like:
Also, SVSegmentedControl introduces “smart” mode, where, if there is enough room, every segment, that needs to be wider than average width, gets enough room to display content (which is usually less then in proportional mode). If there is no enough room for all content - segments width is distributed proportionally (fixed, of course :) ).
NOTE. SVSegmentedControl is designed and test only to work with segments with titles, not with images.
SVSegmentedControl provides two new properties to adjust it’s behaviour:
As you can see, you can change them in runtime, or configure in IB.
To run the example project, clone the repo, and run pod install
from the Example directory first.
SVSegmentedControlSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "SVSegmentedControlSwift"
Eugene Shevtsov, [email protected]
SVSegmentedControlSwift is available under the MIT license. See the LICENSE file for more info.