Latest 0.0.1
Homepage https://github.com/menhui222/SegmentedControl
License MIT
Platforms ios 11.0, requires ARC
Frameworks Foundation, UIKit
Authors

SegmentedControl

Example

Usage

Text


 let s1 = SegmentedControl(titleData: ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
                                 frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 40))

 self.view.addSubview(s1)
  var config = SegmentedConfig()
        config.chief_w = 50
        config.trail_w = 50
        config.space_w = 50
        config.itemSelectedColor = UIColor.yellow
        config.itemDefultColor = UIColor.gray
        config.titleFont = UIFont.systemFont(ofSize: 30)

        let s2 = SegmentedControl(config:config,titleData: ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],
                                  frame: CGRect(x: 0, y: 70, width: self.view.frame.width, height: 40))

        //如果要修改
        s2.configSegmentItem {  () in
            var config = SegmentedConfig()
            config.titleFont = UIFont.systemFont(ofSize: 20)
            config.itemSelectedColor = UIColor.yellow
            return config
        }
        s2.lineColor = UIColor.yellow

        self.view.addSubview(s2)

        s2.segmentedItemSelected = {(model) in
//            model.index
//            model.size
//            model.text
        }

Latest podspec

{
    "name": "SegmentedControlSwift",
    "version": "0.0.1",
    "summary": "swift segmentedControl",
    "description": "Custom segmentedControl for iOS written in Swift",
    "homepage": "https://github.com/menhui222/SegmentedControl",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "u5b5fu8f89": "[email protected]"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/menhui222/SegmentedControl.git",
        "tag": "0.0.1"
    },
    "swift_version": "4.2",
    "source_files": [
        "Classes",
        "SegmentedControl/**/*.{swift}"
    ],
    "exclude_files": "SegmentedControl/*.swift",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This