SSSegmentedControl
is an UISegmentedControl
'Extension' written in Objective-C. With this 'Extension' multiple segment selection is available.
- Easy to color active / selected segments
- Declare the maximum allowed number of active segments
- Deselection enabled
- Deselected segments always have the default color declared in storyboard
- iOS 7.0 and above
SSSegmentedControl
is licensed under the MIT License, please check License file.
- In
Storyboard
select a segmented control and set its custom class toSSSegmentedControl
. - Define the number of segments; name them; color them; etc.
- Open the
ViewController.h
and connect an Outlet and IBAction to theSSSegmentedControl
. - Open the
ViewController.m
and add inviewDidLoad()
:
[_segmentedControl setupSSSegmentedControlWithNumberOfSegments:'Number of Segments' withMaxActiveSegments:'Max Active Segments' andWithActiveColor:'Color'];
- Chose max. active segments = 0, to use default segmented control features / options.
- In the
IBAction
add:
[_segmentedControl segmentedControlActionWithSelectedSegmentAction:@selector('Method for selected segment':) andDeselectedAction:@selector('Method for deselected segment':) andTarget:self];
- At last define an Method / Function for selected segment and deselected segment and connect them above with the selectors.
- Pay attention! :
-(void)methodNameForSelected/DeselectedSegment:(SSSegmentedControl*)sender
!
- Check out the Demo Project for documented methods !
- Feel free to message me at: [email protected]