Latest | 1.1.0 |
---|---|
Homepage | https://github.com/hirohitokato/HKLSegmentedControl |
License | MIT |
Platforms | ios 7.0, requires ARC |
A subclass of UISegmentedControl which supports dynamically value changing.
HKLSegmentedControl is a fully compatible class with UISegmentedControl.
In addition to that, it supports touch moving events.
The delegate method is called each time when you swipe on the control.
:bulb: Features
- Fully compatible with UISegmentedControll class
- Support dynamic event handling
- Of course, support Value Changed event, too.
- Works on iOS
:book: Usage
Interface
is very simple!
@interface HKLSegmentedControl : UISegmentedControl
@property (nonatomic, weak)id<HKLSegmentedControlDelegate> delegate;
@property (nonatomic, readonly)NSInteger highlightedSegmentIndex;
@end
@protocol HKLSegmentedControlDelegate <NSObject>
@optional
- (void)segmentedControl:(HKLSegmentedControl*)control didBeginTouch:(NSInteger)highlightedSegmentIndex;
- (void)segmentedControl:(HKLSegmentedControl*)control didChangedHighlightedIndex:(NSInteger)highlightedSegmentIndex;
@end
Receive update events
Use segmentedControl:didChangedHighlightedIndex:
delegate method.
@interface ViewController () <HKLSegmentedControlDelegate>
@property (weak, nonatomic) IBOutlet HKLSegmentedControl *segment;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_segment.delegate = self;
}
// Receive dynamic update events
- (void)segmentedControl:(HKLSegmentedControl *)control didChangedHighlightedIndex:(NSInteger)highlightedSegmentIndex {
// Do anything!
}
// Can receive Value Changed(=touch up inside) event.
- (IBAction)selected:(id)sender {
}
@end
Requirements
iOS 7 or later
Installation
CocoaPods
HKLSegmentedControl is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'HKLSegmentedControl'
Author
Hirohito Kato
License
HKLSegmentedControl is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "HKLSegmentedControl", "version": "1.1.0", "summary": "A subclass of UISegmentedControl which supports dynamically value changing.", "description": " HKLSegmentedControl is a fully compatible class with UISegmentedControl.n In addition to that, it supports touch moving events.n The delegate method is called each time when you swipe on the control.n", "homepage": "https://github.com/hirohitokato/HKLSegmentedControl", "screenshots": "https://raw.githubusercontent.com/hirohitokato/HKLSegmentedControl/master/images/screenshots_1.gif", "source": { "git": "https://github.com/hirohitokato/HKLSegmentedControl.git", "tag": "v1.1.0" }, "license": "MIT", "authors": "Hirohito Kato", "social_media_url": "http://twitter.com/hkato193", "platforms": { "ios": "7.0" }, "requires_arc": true, "source_files": "Libs/*.{h,m}" }
Sun, 06 Mar 2016 15:56:03 +0000