Latest 0.0.4
Homepage https://github.com/QiuZhiFei/ZFSegmentView
License MIT
Platforms ios 8.0, requires ARC
Authors

Description

Cocoapods

Add pod 'ZFSegmentView', '~> 0.0.4' to Podfile.

Requirements

  • iOS 8.0+
  • Swift 3.0+

How To Use

Step1

let configs = [ZFSegmentConfig(
      normalAttributedText: NSMutableAttributedString(string: "Song", attributes: normalAttri),
      selectedAttributedText: NSMutableAttributedString(string: "Song", attributes: greenAttri),
      indicatorColor: indicatorColor,
      indicatorBottom: indicatorBottom,
      indicatorHeight: indicatorHeight),
                   ZFSegmentConfig(
                    normalAttributedText: NSMutableAttributedString(string: "Songlist", attributes: normalAttri),
                    selectedAttributedText: NSMutableAttributedString(string: "Songlist", attributes: greenAttri),
                    indicatorColor: indicatorColor,
                    indicatorBottom: indicatorBottom,
                    indicatorHeight: indicatorHeight)]

Step2

let segmentView = ZFSegmentView(frame: .zero,
                                        contentEdge: UIEdgeInsetsMake(0, 0, 0, 0), configs: configs, type: .center)
    segmentView.backgroundColor = UIColor.white
    segmentView.frame = CGRect(x: 20, y: 164, width: self.view.bounds.size.width - 40, height: 40)
    segmentView.animationDuration = 0.2
    segmentView.startIndex = 3
    segmentView.didSelectHandler = {
      (oldIndex, newIndex) in
      print("old == (oldIndex)")
      if oldIndex != newIndex {
        print("new == (newIndex)")
      }
    }

Latest podspec

{
    "name": "ZFSegmentView",
    "version": "0.0.4",
    "summary": "Custom segmented view for iOS8 / Swift3 and above",
    "description": "Custom segmented view for iOS8 / Swift3 and above.",
    "homepage": "https://github.com/QiuZhiFei/ZFSegmentView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "qiuzhifei": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/QiuZhiFei/ZFSegmentView.git",
        "tag": "0.0.4"
    },
    "source_files": [
        "Classes",
        "Core/*.{swift}"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This