MultiSelectSegmentedControl
Multiple-Selection UISegmentedControl.
A subclass of UISegmentedControl
that supports selecting multiple segments.
No need for images - works with the builtin styles of UISegmentedControl.
Features
- [x] Standard iOS look and feel.
- [x] Use from either storyboard or code.
Requirements
- iOS 8.0+
- Xcode 7.3
Installation
CocoaPods
You can use CocoaPods to install YourLibrary
by adding it to your Podfile
:
To get the full benefits import YourLibrary
wherever you import UIKit
Usage
Creating a MultiSelectSegmentedControl
In Interface Builder:
- Drag a
UISegmentedControl
into your storyboard. - Set its class to
MultiSelectSegmentedControl
. - Set an outlet for it, e.g.,
myMultiSeg
.
In code:
Setting selected segments
Getting selected segments
Or to get the titles:
Handling user selection changes
To be notified of changes to the control's value, make sure your ViewController conforms to the delegate protocol:
...and set the delegate, perhaps in your viewDidLoad
method:
Then override the delegate protocol method: