Skip to content

george-gw/ATHMultiSelectionSegmentedControl

 
 

Repository files navigation

ATHMultiSelectionSegmentedControl

CI Status Version License Platform Language

Logo

ATHMultiSelectionSegmentedControl is a UIView based control mimicking the API of UISegmentedControl but also allowing for multiple selection of segments. It's fully battle and unit-tested. If you find any bugs or want to suggest improvements please feel free to contribute.

Demo

API

import ATHMultiSelectionSegmentedControl

// initialize empty segmented control
let segmentedControl = ATHMultiSelectionSegmentedControl()

// Add items to segmented control at once...
segmentedControl.insertSegmentsWithTitles(["Segment 1", "Segment 2", "Segment 3"])

// ... or one by one
segmentedControl.insertSegmentWithTitle("Segment 4", atIndex: 3, animated: true)

// Get and set items
segmentedControl.titleForSegmentAtIndex(0) // Segment 1
segmentControl.setTitle("Title", forSegmentAtIndex: 0)
segmentedControl.titleForSegmentAtIndex(0) // Title

// Enable or disable an option
segmentedControl.setEnabled(false, forSegmentAtIndex: 0) // "Title" segment is now disabled
segmentedControl.isEnabledForSegmentAtIndex(0) // false
segmentedControl.setEnabled(true, forSegmentAtIndex: 0) // "Title" segment is now enabled
segmentedControl.isEnabledForSegmentAtIndex(0) // true 

Example

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

Installation

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

pod "ATHMultiSelectionSegmentedControl"

Author

attheodo, at@atworks.gr

License

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

Changelog

  • v0.1.0, May 2016
    • Initial release

About

A Swifty segmented control that allows for multiple options selection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 59.1%
  • Shell 35.7%
  • Ruby 2.8%
  • Objective-C 2.4%