Latest 0.1.1
Homepage https://github.com/svilon/SVSegmentedControlSwift
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

Version
License
Platform

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.

UISegmentedControl

With SVSegmentedControl issue is fixed and same segmented control will look like:

SVSegmentedControl

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.

Usage

SVSegmentedControl provides two new properties to adjust it’s behaviour:

  • @IBInspectable public var fixNativeProportionalSizing: Bool = false
  • @IBInspectable public var smartAdjustment: Bool = false

As you can see, you can change them in runtime, or configure in IB.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

SVSegmentedControlSwift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SVSegmentedControlSwift"

Author

Eugene Shevtsov, i.i.shevtsov@gmail.com

License

SVSegmentedControlSwift is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SVSegmentedControlSwift",
    "deprecated_in_favor_of": "SmartSegmentedControlSwift",
    "version": "0.1.1",
    "summary": "UISegmentedControl replacement which provides more accurate segments width management",
    "description": "This control was created to solve issue, that native UISegmentedControl has. Reffer to SVSegmentedControl for obj-c version.nUISegmentedControl has issue with apportionsSegmentWidthsByContent setting (adjust segments width proportionally to content). Often, it appears that control bounds are wider, than actual segments width.nWith SVSegmentedControl issue is fixed.nAlso, SVSegmentedControl introduces u201csmartu201d 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 :) ).nNOTE. SVSegmentedControl is designed and test only to work with segments with titles, not with images.",
    "homepage": "https://github.com/svilon/SVSegmentedControlSwift",
    "screenshots": [
        "https://github.com/svilon/SVSegmentedControlSwift/blob/master/Screens/Example_app.png?raw=true",
        "https://github.com/svilon/SVSegmentedControlSwift/blob/master/Screens/UISegmentedControl.png?raw=true",
        "https://github.com/svilon/SVSegmentedControlSwift/blob/master/Screens/SVSegmentedControl.png?raw=true"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Eugene Shevtsov": "i.i.shevtsov@gmail.com"
    },
    "source": {
        "git": "https://github.com/svilon/SVSegmentedControlSwift.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "module_name": "SVSegmentedControl",
    "source_files": "SVSegmentedControlSwift/Classes/**/*",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This