A custom segment control,it is a subclass of UIScrollView
- Support horizontal scrolling
- Supports selection indicator both on top and bottom
- Supports blocks
- Works with ARC and iOS >= 7
The code below will create a segmented control with the default looks:
LTSegmentControl *segmentedControl = [[HMSegmentedControl alloc] initWithSectionTitles:@[@"One", @"Two", @"Three"]];
segmentedControl.frame = CGRectMake(10, 10, 300, 60);
[self.view addSubview:segmentedControl];
Included is a demo project showing how to fully customise the control.
- Add
LTSegmentControl.h
andLTSegmentControl.m
to your project. #import "LTSegmentControl.h"
where you want to add the control.
pod LTSegmentControl
LTSegmentedControl is licensed under the terms of the Apache License. Please see the LICENSE file for full details.
If this code was helpful, I would love to hear from you.