Latest 1.0.1
Homepage https://github.com/tahseen0amin/TZSegmentedControl
License MIT
Platforms ios 10.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Swift alternative of HMSegmentedControl by Hesham Megid. A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

Example

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

Requirements

  • Swift 4.2 and above
  • iOS 10 and above

Installation

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

pod "TZSegmentedControl"

Usage

Please check code in Example Project to see how you can customize the TZSegmentedControl.

For creating a new TZSegmentedControl

let titleCont = TZSegmentedControl(sectionTitles: ["TRENDING","EDITOR'S PICKS", "FOR YOU", "VIDEOS", "LANGUAGE" ])
titleCont.frame = CGRect(x: 0, y: 50, width: self.view.frame.width, height: 50)

TZSegmentedControl also provide a block to be executed when selected index is changed. Alternativly, you could use addTarget:action:forControlEvents:

 titleCont.indexChangeBlock = { (index) in
  debugPrint("Segmented (titleCont.sectionTitles[index]) is visible now")
 }

Screenshot

screenshot

Author

[email protected], [email protected]

License

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

Thanks

Thanks to Hesham Megid whose code in HMSegmentedControl was helpful.

Latest podspec

{
    "name": "TZSegmentedControl",
    "version": "1.0.1",
    "summary": "A scrollable segmented control view.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/tahseen0amin/TZSegmentedControl",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tahseen0amin/TZSegmentedControl.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2",
    "source_files": "TZSegmentedControl/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This