Latest 0.1.1
Homepage https://github.com/rb-de0/RBSegmentedControl
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

CI Status
Version
License
Platform

RBSegmentedControl is a subclass of UIView like UISegmentedControl. You can customize some colors. Also, It supports AutoLayout. So, you can use this on the UIStoryBoards.

Requirements

  • Swift 2.2 / Xcode 7.3
  • iOS 8.0 or later (by CocoaPods) / iOS 7 (by copying the source files to your proj directory)

Installation

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'RBSegmentedControl'

Usage

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

Sample of simple handling.

class ViewController: UIViewController {
    @IBOutlet weak var segmentedControl: RBSegmentedControl!

    override func viewDidLoad() {
        super.viewDidLoad()
        segmentedControl.addSegments("0", "1", "2")
        segmentedControl.delegate = self

         // Customize Colors
        segmentedControl.borderColor = UIColor.brownColor()
        segmentedControl.segmentBackgroundColor = UIColor.whiteColor()
        segmentedControl.selectedSegmentBackgroundColor = UIColor.brownColor()
        segmentedControl.segmentTextColor = UIColor.brownColor()
        segmentedControl.selectedSegmentTextColor = UIColor.whiteColor()
    }
}

// MARK: - RBSegmentedControlDelegate
extension ViewController: RBSegmentedControlDelegate{
    func rb_segmentedControl(didChangedSelectedIndex index: Int) {
        print(index)
    }
}

Screen Shot

Basic Functions

  • addSegments … Adding segment titles by variable-length arguments.
  • removeSegments … Removing segments.

Basic Property of RBSegmentedControl

  • selectedSegmentTextColor
  • segmentTextColor
  • selectedSegmentBackgroundColor
  • segmentBackgroundColor
  • borderColor

Author

rb_de0, [email protected]

License

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

Latest podspec

{
    "name": "RBSegmentedControl",
    "version": "0.1.1",
    "summary": "A Color Customizable UISegmentedControl",
    "description": "RBSegmentedControl is SubClass of UIView that you can customize the color .",
    "homepage": "https://github.com/rb-de0/RBSegmentedControl",
    "license": "MIT",
    "authors": {
        "rb_de0": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rb-de0/RBSegmentedControl.git",
        "tag": "0.1.1"
    },
    "social_media_url": "https://twitter.com/rb_de0",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "RBSegmentedControl": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This