├── .gitignore ├── LICENSE ├── Package.swift ├── README.md ├── Sources └── StepSlider │ ├── StepSlider.m │ └── include │ └── StepSlider.h ├── StepSlider.podspec ├── StepSlider.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── StepSlider.xcscheme ├── StepSlider ├── Info.plist ├── StepSlider-Info.plist ├── Supporting Files │ └── main.m ├── res │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── selected_dot.imageset │ │ │ ├── Contents.json │ │ │ └── selcted.pdf │ │ ├── thumb.imageset │ │ │ ├── Contents.json │ │ │ └── thumb.pdf │ │ └── unselected_dot.imageset │ │ │ ├── Contents.json │ │ │ └── unselected.pdf │ └── nibs │ │ └── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard └── source │ ├── AppDelegate.h │ ├── AppDelegate.m │ └── ViewController │ ├── ViewController.h │ └── ViewController.m └── screenshots ├── attributedString.png ├── example.gif ├── example_labels.gif └── images.png /.gitignore: -------------------------------------------------------------------------------- 1 | #Mac OS X 2 | .DS_Store 3 | ._* 4 | .Spotlight-V100 5 | .Trashes 6 | 7 | # Xcode 8 | build/* 9 | depositphotos/Build/* 10 | Build/* 11 | Breakpoints.xcbkptlist 12 | UserInterfaceState.xcuserstate 13 | WorkspaceSettings.xcsettings 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | *.xcworkspace 23 | !default.xcworkspace 24 | xcuserdata 25 | profile 26 | *.moved-aside 27 | DerivedData 28 | Carthage/ 29 | 30 | /.build 31 | /Packages 32 | xcuserdata/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 spromicky 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.1 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "StepSlider", 7 | platforms: [.iOS(.v10)], 8 | products: [ 9 | .library(name: "StepSlider", targets: ["StepSlider"]) 10 | ], 11 | targets: [ 12 | .target(name: "StepSlider") 13 | ] 14 | ) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StepSlider 2 | 3 | StepSlider its custom implementation of slider such as `UISlider` for preset values. Behind the scenes StepSlider manipulate integer indexes. Its based on drawing directlyon `CAShapeLayer`. 4 | 5 | ![](screenshots/example.gif) 6 | 7 | ## Usage 8 | 9 | You can add StepSlider right from code with any of standard initialisers. Or you can add it directly on your storybord. Its fully `IBDesignable` and `IBInspetable` compatible. 10 | 11 | ```objc 12 | StepSlider *slider = [[StepSlider alloc] initWithFrame:CGRectMake(10.f, 200.f, 300.f, 44.f)]; 13 | [slider setMaxCount:10]; 14 | [slider setIndex:2]; 15 | [self.view addSubview:slider]; 16 | ``` 17 | 18 | StepSlider can be fully customised by any of this properties: 19 | 20 | - `trackHeight` 21 | - `trackCircleRadius` 22 | - `sliderCircleRadius` 23 | - `dotsInteractionEnabled` 24 | - `trackColor` 25 | - `sliderCircleColor` 26 | - `sliderCircleImage` 27 | 28 | Supports haptic feedback on `valueChanged:`. 29 | 30 | #### Labels 31 | 32 | From version `1.0.0` StepSlider support labels near each circle on track. 33 | 34 | ```objc 35 | slider.labels = @[@"Some string", @"another string", @"one more"]; 36 | ``` 37 | 38 | ![](screenshots/example_labels.gif) 39 | 40 | `slider.adjustLabel` - set first and last label to exactly to frame left and right. 41 | 42 | From version `1.8.0` StepSlider support `NSAttributedString` as label text. 43 | 44 | ![](screenshots/attributedString.png) 45 | 46 | #### Images 47 | 48 | For `1.2.0` and higher you can use images for `sliderCircle ` and `trackCircles`. For `trackCircles` supported two states: `normal` and `selected`. 49 | 50 | ```objc 51 | [self.sliderView setTrackCircleImage:[UIImage imageNamed:@"unselected_dot"] forState:UIControlStateNormal]; 52 | [self.sliderView setTrackCircleImage:[UIImage imageNamed:@"selected_dot"] forState:UIControlStateSelected]; 53 | ``` 54 | 55 | ![](screenshots/images.png) 56 | 57 | ## Requirements 58 | 59 | - version `1.3.0` and above needs iOS 10.0+ 60 | - version `1.2.1` supports iOS 7.0+ 61 | 62 | ## Installation 63 | 64 | ### CocoaPods 65 | 66 | To integrate `StepSlider` into your Xcode project using CocoaPods, specify it in your `Podfile`: 67 | 68 | ``` 69 | pod 'StepSlider', '~> 1.8.0' 70 | ``` 71 | 72 | Then, run the following command: 73 | 74 | ``` 75 | $ pod install 76 | ``` 77 | 78 | ### Carthage 79 | 80 | To integrate `StepSlider` into your Xcode project using Carthage, specify it in your `Cartfile`: 81 | 82 | ``` 83 | github "spromicky/StepSlider" ~> 1.8.0 84 | ``` 85 | 86 | Run `carthage update` to build the framework and drag the built `StepSlider.framework` into your Xcode project. 87 | 88 | ### Swift Package Manager 89 | 90 | Start `1.8.0` StepSlider can be integrated in your Xcode project. When adding new package search `StepSlider` and select version `1.8.0` or above. 91 | 92 | ### Manual Installation 93 | 94 | Just copy `StepSlider` class to your project. 95 | 96 | ## License 97 | 98 | StepSlider is available under the MIT license. See the LICENSE file for more info. 99 | -------------------------------------------------------------------------------- /Sources/StepSlider/StepSlider.m: -------------------------------------------------------------------------------- 1 | // 2 | // StepSlider.m 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import "StepSlider.h" 10 | 11 | #define GENERATE_SETTER(PROPERTY, TYPE, SETTER, UPDATER) \ 12 | - (void)SETTER:(TYPE)PROPERTY { \ 13 | if (_##PROPERTY != PROPERTY) { \ 14 | _##PROPERTY = PROPERTY; \ 15 | UPDATER \ 16 | [self setNeedsLayout]; \ 17 | } \ 18 | } 19 | 20 | static NSString * const kTrackAnimation = @"kTrackAnimation"; 21 | 22 | typedef void (^withoutAnimationBlock)(void); 23 | void withoutCAAnimation(withoutAnimationBlock code) 24 | { 25 | [CATransaction begin]; 26 | [CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions]; 27 | code(); 28 | [CATransaction commit]; 29 | } 30 | 31 | @interface StepSlider () 32 | { 33 | CAShapeLayer *_trackLayer; 34 | CAShapeLayer *_sliderCircleLayer; 35 | NSMutableArray *_trackCirclesArray; 36 | NSMutableArray *_trackLabelsArray; 37 | NSMutableDictionary *_trackCircleImages; 38 | 39 | UIImpactFeedbackGenerator* _selectFeedback; 40 | 41 | BOOL animateLayouts; 42 | 43 | CGFloat maxRadius; 44 | CGFloat diff; 45 | 46 | CGPoint startTouchPosition; 47 | CGPoint startSliderPosition; 48 | 49 | CGSize contentSize; 50 | } 51 | 52 | @end 53 | 54 | @implementation StepSlider 55 | 56 | #pragma mark - Init 57 | 58 | - (instancetype)initWithFrame:(CGRect)frame 59 | { 60 | self = [super initWithFrame:frame]; 61 | if (self) { 62 | _index = 2; 63 | [self generalSetup]; 64 | } 65 | return self; 66 | } 67 | 68 | - (instancetype)initWithCoder:(NSCoder *)aDecoder 69 | { 70 | self = [super initWithCoder:aDecoder]; 71 | if (self) { 72 | [self generalSetup]; 73 | } 74 | return self; 75 | } 76 | 77 | - (void)addLayers 78 | { 79 | _dotsInteractionEnabled = YES; 80 | _trackCirclesArray = [[NSMutableArray alloc] init]; 81 | _trackLabelsArray = [[NSMutableArray alloc] init]; 82 | _trackCircleImages = [[NSMutableDictionary alloc] init]; 83 | 84 | _trackLayer = [CAShapeLayer layer]; 85 | _sliderCircleLayer = [CAShapeLayer layer]; 86 | _sliderCircleLayer.contentsScale = [UIScreen mainScreen].scale; 87 | _sliderCircleLayer.actions = @{@"contents": [NSNull null]}; 88 | 89 | [self.layer addSublayer:_sliderCircleLayer]; 90 | [self.layer addSublayer:_trackLayer]; 91 | 92 | _labelFont = [UIFont systemFontOfSize:15.f]; 93 | contentSize = self.bounds.size; 94 | } 95 | 96 | - (void)generalSetup 97 | { 98 | [self addLayers]; 99 | 100 | if (_maxCount == 0) { 101 | _maxCount = 4; 102 | } 103 | if (_trackHeight == 0.f) { 104 | _trackHeight = 4.f; 105 | } 106 | if (_trackCircleRadius == 0.f) { 107 | _trackCircleRadius = 5.f; 108 | } 109 | if (_sliderCircleRadius == 0.f) { 110 | _sliderCircleRadius = 12.5f; 111 | } 112 | if (_labelOffset == 0.f) { 113 | _labelOffset = 20.f; 114 | } 115 | if (!_trackColor) { 116 | _trackColor = [UIColor colorWithWhite:0.41f alpha:1.f]; 117 | } 118 | if (!_sliderCircleColor) { 119 | _sliderCircleColor = [UIColor whiteColor]; 120 | } 121 | if (!_labelColor) { 122 | _labelColor = [UIColor whiteColor]; 123 | } 124 | 125 | [self updateMaxRadius]; 126 | [self setNeedsLayout]; 127 | } 128 | 129 | - (CGSize)intrinsicContentSize 130 | { 131 | return contentSize; 132 | } 133 | 134 | #pragma mark - Draw 135 | 136 | - (void)prepareForInterfaceBuilder 137 | { 138 | [self updateMaxRadius]; 139 | [super prepareForInterfaceBuilder]; 140 | } 141 | 142 | - (void)layoutLayersAnimated:(BOOL)animated 143 | { 144 | NSInteger indexDiff = fabsf(roundf([self indexCalculate]) - self.index); 145 | BOOL left = (roundf([self indexCalculate]) - self.index) < 0; 146 | 147 | CGFloat contentWidth = self.bounds.size.width - 2 * maxRadius; 148 | CGFloat stepWidth = contentWidth / (self.maxCount - 1); 149 | 150 | CGFloat sliderHeight = fmaxf(maxRadius, self.trackHeight / 2.f) * 2.f; 151 | CGFloat labelsHeight = [self labelHeightWithMaxWidth:stepWidth] + self.labelOffset; 152 | CGFloat totalHeight = sliderHeight + labelsHeight; 153 | 154 | contentSize = CGSizeMake(fmaxf(44.f, self.bounds.size.width), fmaxf(44.f, totalHeight)); 155 | if (!CGSizeEqualToSize(self.bounds.size, contentSize)) { 156 | if (self.constraints.count) { 157 | [self invalidateIntrinsicContentSize]; 158 | } else { 159 | CGRect newFrame = self.frame; 160 | newFrame.size = contentSize; 161 | self.frame = newFrame; 162 | } 163 | } 164 | 165 | CGFloat contentFrameY = (self.bounds.size.height - totalHeight) / 2.f; 166 | 167 | if (self.labelOrientation == StepSliderTextOrientationUp && self.labels.count) { 168 | contentFrameY += labelsHeight; 169 | } 170 | 171 | CGRect contentFrame = CGRectMake(maxRadius, contentFrameY, contentWidth, sliderHeight); 172 | 173 | CGFloat circleFrameSide = self.trackCircleRadius * 2.f; 174 | CGFloat sliderDiameter = self.sliderCircleRadius * 2.f; 175 | 176 | CGPoint oldPosition = _sliderCircleLayer.position; 177 | CAShapeLayer * trackLayerCopy = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:_trackLayer]]; 178 | CGPathRef oldPath = trackLayerCopy.path; 179 | 180 | CGFloat labelsY = self.labelOrientation ? (self.bounds.size.height - totalHeight) / 2.f : (CGRectGetMaxY(contentFrame) + self.labelOffset); 181 | 182 | if (!animated) { 183 | [CATransaction begin]; 184 | [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; 185 | } 186 | 187 | 188 | if (self.sliderCircleImage) { 189 | _sliderCircleLayer.path = NULL; 190 | _sliderCircleLayer.frame = CGRectMake(0.f, 0.f, fmaxf(self.sliderCircleImage.size.width, 44.f), fmaxf(self.sliderCircleImage.size.height, 44.f)); 191 | _sliderCircleLayer.contents = (__bridge id)self.sliderCircleImage.CGImage; 192 | _sliderCircleLayer.contentsGravity = kCAGravityCenter; 193 | } else { 194 | CGFloat sliderFrameSide = fmaxf(self.sliderCircleRadius * 2.f, 44.f); 195 | CGRect sliderDrawRect = CGRectMake((sliderFrameSide - sliderDiameter) / 2.f, (sliderFrameSide - sliderDiameter) / 2.f, sliderDiameter, sliderDiameter); 196 | 197 | _sliderCircleLayer.contents = nil; 198 | _sliderCircleLayer.frame = CGRectMake(0.f, 0.f, sliderFrameSide, sliderFrameSide); 199 | _sliderCircleLayer.path = [UIBezierPath bezierPathWithRoundedRect:sliderDrawRect cornerRadius:sliderFrameSide / 2].CGPath; 200 | _sliderCircleLayer.fillColor = [self.sliderCircleColor CGColor]; 201 | } 202 | _sliderCircleLayer.position = CGPointMake(contentFrame.origin.x + stepWidth * self.index, CGRectGetMidY(contentFrame)); 203 | 204 | if (animated) { 205 | CABasicAnimation *basicSliderAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; 206 | basicSliderAnimation.duration = [CATransaction animationDuration]; 207 | basicSliderAnimation.fromValue = [NSValue valueWithCGPoint:(oldPosition)]; 208 | [_sliderCircleLayer addAnimation:basicSliderAnimation forKey:@"position"]; 209 | } 210 | 211 | _trackLayer.frame = CGRectMake(contentFrame.origin.x, 212 | CGRectGetMidY(contentFrame) - self.trackHeight / 2.f, 213 | contentFrame.size.width, 214 | self.trackHeight); 215 | _trackLayer.path = [self fillingPath]; 216 | _trackLayer.backgroundColor = [self.trackColor CGColor]; 217 | _trackLayer.fillColor = [self.tintColor CGColor]; 218 | 219 | if (animated) { 220 | CABasicAnimation *basicTrackAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; 221 | basicTrackAnimation.duration = [CATransaction animationDuration]; 222 | basicTrackAnimation.fromValue = (__bridge id _Nullable)(oldPath); 223 | [_trackLayer addAnimation:basicTrackAnimation forKey:@"path"]; 224 | } 225 | 226 | 227 | _trackCirclesArray = [self clearExcessLayers:_trackCirclesArray]; 228 | 229 | CGFloat currentWidth = self.adjustLabel ? _trackLabelsArray.firstObject.bounds.size.width * 2 : _trackLabelsArray.firstObject.bounds.size.width; 230 | if ((currentWidth > 0 && currentWidth != stepWidth) || !self.labels.count) { 231 | [self removeLabelLayers]; 232 | } 233 | 234 | NSTimeInterval animationTimeDiff = 0; 235 | if (indexDiff > 0) { 236 | animationTimeDiff = (left ? [CATransaction animationDuration] : -[CATransaction animationDuration]) / indexDiff; 237 | } 238 | NSTimeInterval animationTime = left ? animationTimeDiff : [CATransaction animationDuration] + animationTimeDiff; 239 | CGFloat circleAnimation = circleFrameSide / _trackLayer.frame.size.width; 240 | 241 | for (NSUInteger i = 0; i < self.maxCount; i++) { 242 | CAShapeLayer *trackCircle; 243 | CATextLayer *trackLabel; 244 | 245 | if (self.labels.count) { 246 | trackLabel = [self textLayerWithSize:CGSizeMake([self roundForTextDrawing:stepWidth], labelsHeight - self.labelOffset) index:i]; 247 | } 248 | 249 | if (i < _trackCirclesArray.count) { 250 | trackCircle = _trackCirclesArray[i]; 251 | } else { 252 | trackCircle = [CAShapeLayer layer]; 253 | trackCircle.actions = @{@"fillColor": [NSNull null], 254 | @"contents": [NSNull null]}; 255 | 256 | [self.layer addSublayer:trackCircle]; 257 | 258 | [_trackCirclesArray addObject:trackCircle]; 259 | } 260 | 261 | 262 | trackCircle.bounds = CGRectMake(0.f, 0.f, circleFrameSide, circleFrameSide); 263 | trackCircle.position = CGPointMake(contentFrame.origin.x + stepWidth * i, CGRectGetMidY(contentFrame)); 264 | 265 | CGImageRef trackCircleImage = [self trackCircleImage:trackCircle]; 266 | if (!trackCircleImage) { 267 | trackCircle.path = [UIBezierPath bezierPathWithRoundedRect:trackCircle.bounds cornerRadius:circleFrameSide / 2].CGPath; 268 | trackCircle.contents = nil; 269 | } else { 270 | trackCircle.path = NULL; 271 | } 272 | 273 | trackLabel.position = CGPointMake(contentFrame.origin.x + stepWidth * i, labelsY); 274 | trackLabel.foregroundColor = self.labelColor.CGColor; 275 | 276 | if (animated) { 277 | if (trackCircleImage) { 278 | CGImageRef oldImage = (__bridge CGImageRef)(trackCircle.contents); 279 | 280 | if (oldImage != trackCircleImage) { 281 | [self animateTrackCircleChanges:trackCircle from:(__bridge id)(oldImage) to:(__bridge id)(trackCircleImage) keyPath:@"contents" beginTime:animationTime duration:circleAnimation]; 282 | animationTime += animationTimeDiff; 283 | } 284 | } else { 285 | CGColorRef newColor = [self trackCircleColor:trackCircle]; 286 | CGColorRef oldColor = trackCircle.fillColor; 287 | 288 | if (!CGColorEqualToColor(newColor, oldColor)) { 289 | [self animateTrackCircleChanges:trackCircle from:(__bridge id)(oldColor) to:(__bridge id)(newColor) keyPath:@"fillColor" beginTime:animationTime duration:circleAnimation]; 290 | animationTime += animationTimeDiff; 291 | } 292 | } 293 | } else { 294 | if (trackCircleImage) { 295 | trackCircle.contents = (__bridge id _Nullable)(trackCircleImage); 296 | } else { 297 | trackCircle.fillColor = [self trackCircleColor:trackCircle]; 298 | } 299 | } 300 | 301 | } 302 | 303 | if (!animated) { 304 | [CATransaction commit]; 305 | } 306 | 307 | [_sliderCircleLayer removeFromSuperlayer]; 308 | [self.layer addSublayer:_sliderCircleLayer]; 309 | } 310 | 311 | - (void)layoutSubviews 312 | { 313 | [super layoutSubviews]; 314 | 315 | [self layoutLayersAnimated:animateLayouts]; 316 | animateLayouts = NO; 317 | } 318 | 319 | #pragma mark - Helpers 320 | 321 | - (void)animateTrackCircleChanges:(CAShapeLayer *)trackCircle from:(id)fromValue to:(id)toValue keyPath:(NSString *)keyPath beginTime:(CFTimeInterval)beginTime duration:(CFTimeInterval)duration 322 | { 323 | CABasicAnimation *basicTrackCircleAnimation = [CABasicAnimation animationWithKeyPath:kTrackAnimation]; 324 | basicTrackCircleAnimation.fillMode = kCAFillModeBackwards; 325 | basicTrackCircleAnimation.beginTime = CACurrentMediaTime() + beginTime; 326 | basicTrackCircleAnimation.duration = [CATransaction animationDuration] * duration; 327 | basicTrackCircleAnimation.keyPath = keyPath; 328 | basicTrackCircleAnimation.fromValue = fromValue; 329 | basicTrackCircleAnimation.toValue = toValue; 330 | 331 | [trackCircle addAnimation:basicTrackCircleAnimation forKey:kTrackAnimation]; 332 | [trackCircle setValue:basicTrackCircleAnimation.toValue forKey:basicTrackCircleAnimation.keyPath]; 333 | } 334 | 335 | - (NSMutableArray *)clearExcessLayers:(NSMutableArray *)layers 336 | { 337 | if (layers.count > self.maxCount) { 338 | 339 | for (NSUInteger i = self.maxCount; i < layers.count; i++) { 340 | [layers[i] removeFromSuperlayer]; 341 | } 342 | 343 | return [[layers subarrayWithRange:NSMakeRange(0, self.maxCount)] mutableCopy]; 344 | } 345 | 346 | return layers; 347 | } 348 | 349 | - (CGFloat)labelHeightWithMaxWidth:(CGFloat)maxWidth 350 | { 351 | if (self.labels.count) { 352 | CGFloat labelHeight = 0.f; 353 | 354 | for (NSUInteger i = 0; i < self.labels.count; i++) { 355 | CGSize size; 356 | if (self.adjustLabel && (i == 0 || i == self.labels.count - 1)) { 357 | size = CGSizeMake([self roundForTextDrawing:maxWidth / 2.f + maxRadius], CGFLOAT_MAX); 358 | } else { 359 | size = CGSizeMake([self roundForTextDrawing:maxWidth], CGFLOAT_MAX); 360 | } 361 | 362 | CGFloat height; 363 | 364 | if ([self.labels[i] isKindOfClass:[NSString class]]) { 365 | height = [self.labels[i] boundingRectWithSize:size 366 | options:NSStringDrawingUsesLineFragmentOrigin 367 | attributes:@{NSFontAttributeName : self.labelFont} 368 | context:nil].size.height; 369 | } else { 370 | height = [self.labels[i] boundingRectWithSize:size 371 | options:NSStringDrawingUsesLineFragmentOrigin 372 | context:nil].size.height; 373 | } 374 | labelHeight = fmax(ceil(height), labelHeight); 375 | } 376 | return labelHeight; 377 | } 378 | 379 | return 0; 380 | } 381 | 382 | /* 383 | Calculate distance from trackCircle center to point where circle cross track line. 384 | */ 385 | - (void)updateDiff 386 | { 387 | diff = sqrtf(fmaxf(0.f, powf(self.trackCircleRadius, 2.f) - pow(self.trackHeight / 2.f, 2.f))); 388 | } 389 | 390 | - (void)updateMaxRadius 391 | { 392 | maxRadius = fmaxf(self.trackCircleRadius, self.sliderCircleRadius); 393 | } 394 | 395 | - (void)updateIndex 396 | { 397 | NSAssert(self.maxCount > 1, @"Elements count must be greater than 1!"); 398 | if (_index > (self.maxCount - 1)) { 399 | _index = self.maxCount - 1; 400 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 401 | } 402 | } 403 | 404 | - (CGPathRef)fillingPath 405 | { 406 | CGRect fillRect = _trackLayer.bounds; 407 | fillRect.size.width = self.sliderPosition; 408 | 409 | return [UIBezierPath bezierPathWithRect:fillRect].CGPath; 410 | } 411 | 412 | - (CGFloat)sliderPosition 413 | { 414 | return _sliderCircleLayer.position.x - maxRadius; 415 | } 416 | 417 | - (CGFloat)trackCirclePosition:(CAShapeLayer *)trackCircle 418 | { 419 | return trackCircle.position.x - maxRadius; 420 | } 421 | 422 | - (CGFloat)indexCalculate 423 | { 424 | return self.sliderPosition / (_trackLayer.bounds.size.width / (self.maxCount - 1)); 425 | } 426 | 427 | - (BOOL)trackCircleIsSeleceted:(CAShapeLayer *)trackCircle 428 | { 429 | return self.sliderPosition + diff >= [self trackCirclePosition:trackCircle]; 430 | } 431 | 432 | #pragma mark - Track circle 433 | 434 | - (CGColorRef)trackCircleColor:(CAShapeLayer *)trackCircle 435 | { 436 | return [self trackCircleIsSeleceted:trackCircle] ? self.tintColor.CGColor : self.trackColor.CGColor; 437 | } 438 | 439 | - (CGImageRef)trackCircleImage:(CAShapeLayer *)trackCircle 440 | { 441 | return [self trackCircleImageForState:[self trackCircleIsSeleceted:trackCircle] ? UIControlStateSelected : UIControlStateNormal].CGImage; 442 | } 443 | 444 | - (void)setTrackCircleImage:(UIImage *)image forState:(UIControlState)state 445 | { 446 | _trackCircleImages[@(state)] = image; 447 | [self setNeedsLayout]; 448 | } 449 | 450 | - (UIImage *)trackCircleImageForState:(UIControlState)state 451 | { 452 | return _trackCircleImages[@(state)] ? : _trackCircleImages[@(UIControlStateNormal)]; 453 | } 454 | 455 | #pragma mark - Touches 456 | 457 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer 458 | { 459 | if (![gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { 460 | return NO; 461 | } else { 462 | CGPoint position = [gestureRecognizer locationInView:self]; 463 | return !CGRectContainsPoint(self.bounds, position); 464 | } 465 | } 466 | 467 | - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event 468 | { 469 | startTouchPosition = [touch locationInView:self]; 470 | startSliderPosition = _sliderCircleLayer.position; 471 | 472 | if (self.enableHapticFeedback && ![[NSProcessInfo processInfo] isLowPowerModeEnabled]) { 473 | _selectFeedback = [[UIImpactFeedbackGenerator alloc] init]; 474 | } 475 | 476 | [_selectFeedback prepare]; 477 | if (CGRectContainsPoint(_sliderCircleLayer.frame, startTouchPosition)) { 478 | return YES; 479 | } else if (self.isDotsInteractionEnabled) { 480 | for (NSUInteger i = 0; i < _trackCirclesArray.count; i++) { 481 | CALayer *dot = _trackCirclesArray[i]; 482 | 483 | CGFloat dotRadiusDiff = 22 - self.trackCircleRadius; 484 | CGRect frameToCheck = dotRadiusDiff > 0 ? CGRectInset(dot.frame, -dotRadiusDiff, -dotRadiusDiff) : dot.frame; 485 | 486 | if (CGRectContainsPoint(frameToCheck, startTouchPosition)) { 487 | NSUInteger oldIndex = _index; 488 | 489 | _index = i; 490 | 491 | if (oldIndex != _index) { 492 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 493 | [_selectFeedback impactOccurred]; 494 | [_selectFeedback prepare]; 495 | } 496 | animateLayouts = YES; 497 | [self setNeedsLayout]; 498 | return NO; 499 | } 500 | } 501 | return NO; 502 | } 503 | return NO; 504 | } 505 | 506 | - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event 507 | { 508 | CGFloat position = startSliderPosition.x - (startTouchPosition.x - [touch locationInView:self].x); 509 | CGFloat limitedPosition = fminf(fmaxf(maxRadius, position), self.bounds.size.width - maxRadius); 510 | 511 | withoutCAAnimation(^{ 512 | self->_sliderCircleLayer.position = CGPointMake(limitedPosition, self->_sliderCircleLayer.position.y); 513 | self->_trackLayer.path = [self fillingPath]; 514 | 515 | NSUInteger index = (self.sliderPosition + self->diff) / (self->_trackLayer.bounds.size.width / (self.maxCount - 1)); 516 | if (self->_index != index) { 517 | for (CAShapeLayer *trackCircle in self->_trackCirclesArray) { 518 | CGImageRef trackCircleImage = [self trackCircleImage:trackCircle]; 519 | 520 | if (trackCircleImage) { 521 | trackCircle.contents = (__bridge id _Nullable)(trackCircleImage); 522 | } else { 523 | trackCircle.fillColor = [self trackCircleColor:trackCircle]; 524 | } 525 | } 526 | self->_index = index; 527 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 528 | [self->_selectFeedback impactOccurred]; 529 | [self->_selectFeedback prepare]; 530 | } 531 | }); 532 | 533 | return YES; 534 | } 535 | 536 | - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event 537 | { 538 | [self endTouches]; 539 | } 540 | 541 | - (void)cancelTrackingWithEvent:(UIEvent *)event 542 | { 543 | [self endTouches]; 544 | } 545 | 546 | - (void)endTouches 547 | { 548 | NSUInteger newIndex = roundf([self indexCalculate]); 549 | 550 | if (newIndex != _index) { 551 | _index = newIndex; 552 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 553 | } 554 | 555 | animateLayouts = YES; 556 | [self setNeedsLayout]; 557 | _selectFeedback = nil; 558 | } 559 | 560 | #pragma mark - Texts 561 | 562 | - (CATextLayer *)textLayerWithSize:(CGSize)size index:(NSUInteger)index 563 | { 564 | if (index >= _trackLabelsArray.count) { 565 | CATextLayer *trackLabel = [CATextLayer layer]; 566 | 567 | CGPoint anchorPoint = CGPointMake(0.5f, 0.f); 568 | NSString *alignmentMode = kCAAlignmentCenter; 569 | 570 | if (self.adjustLabel) { 571 | if (index == 0) { 572 | alignmentMode = kCAAlignmentLeft; 573 | size.width = size.width / 2.f + maxRadius; 574 | anchorPoint.x = maxRadius / size.width; 575 | } else if (index == self.labels.count - 1) { 576 | alignmentMode = kCAAlignmentRight; 577 | size.width = size.width / 2.f + maxRadius; 578 | anchorPoint.x = 1.f - maxRadius / size.width; 579 | } 580 | } 581 | 582 | trackLabel.alignmentMode = alignmentMode; 583 | trackLabel.wrapped = YES; 584 | trackLabel.contentsScale = [UIScreen mainScreen].scale; 585 | trackLabel.anchorPoint = anchorPoint; 586 | 587 | CFStringRef fontName = (__bridge CFStringRef)self.labelFont.fontName; 588 | CGFontRef fontRef = CGFontCreateWithFontName(fontName); 589 | 590 | trackLabel.font = fontRef; 591 | trackLabel.fontSize = self.labelFont.pointSize; 592 | CGFontRelease(fontRef); 593 | 594 | trackLabel.string = self.labels[index]; 595 | trackLabel.bounds = CGRectMake(0.f, 0.f, size.width, size.height); 596 | 597 | [self.layer addSublayer:trackLabel]; 598 | [_trackLabelsArray addObject:trackLabel]; 599 | 600 | return trackLabel; 601 | } else { 602 | return _trackLabelsArray[index]; 603 | } 604 | } 605 | 606 | - (void)removeLabelLayers 607 | { 608 | for (CALayer *label in _trackLabelsArray) { 609 | [label removeFromSuperlayer]; 610 | } 611 | [_trackLabelsArray removeAllObjects]; 612 | } 613 | 614 | - (CGFloat)roundForTextDrawing:(CGFloat)value 615 | { 616 | return floor(value * [UIScreen mainScreen].scale) / [UIScreen mainScreen].scale; 617 | } 618 | 619 | #pragma mark - Access methods 620 | 621 | - (void)setIndex:(NSUInteger)index animated:(BOOL)animated 622 | { 623 | animateLayouts = animated; 624 | self.index = index; 625 | } 626 | 627 | - (void)setTintColor:(UIColor *)tintColor 628 | { 629 | [super setTintColor:tintColor]; 630 | [self setNeedsLayout]; 631 | } 632 | 633 | - (void)setLabels:(NSArray *)labels 634 | { 635 | NSAssert(labels.count != 1, @"Labels count can not be equal to 1!"); 636 | 637 | NSMutableArray *mLabels = [NSMutableArray arrayWithArray:labels]; 638 | for (NSUInteger i = 0; i < labels.count; i++) { 639 | BOOL isAttributedString = [labels[i] isKindOfClass:[NSAttributedString class]]; 640 | NSAssert([labels[i] isKindOfClass:[NSString class]] || isAttributedString, @"Labels must be an instance of NSString or NSAttributedString!"); 641 | 642 | if (isAttributedString) { 643 | NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithAttributedString: labels[i]]; 644 | NSRange fullRange = NSMakeRange(0, attributedString.length); 645 | 646 | [attributedString enumerateAttribute:NSFontAttributeName inRange:fullRange options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { 647 | 648 | if (!value) { 649 | [attributedString addAttribute:NSFontAttributeName value:self.labelFont range:range]; 650 | } 651 | }]; 652 | [attributedString enumerateAttribute:NSForegroundColorAttributeName inRange:fullRange options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { 653 | 654 | if (!value) { 655 | [attributedString addAttribute:NSForegroundColorAttributeName value:self.labelColor range:range]; 656 | } 657 | }]; 658 | 659 | mLabels[i] = attributedString; 660 | } 661 | } 662 | 663 | if (_labels != mLabels) { 664 | _labels = mLabels; 665 | 666 | if (_labels.count > 0) { 667 | _maxCount = _labels.count; 668 | } 669 | 670 | [self updateIndex]; 671 | [self removeLabelLayers]; 672 | [self setNeedsLayout]; 673 | } 674 | } 675 | 676 | - (void)setMaxCount:(NSUInteger)maxCount 677 | { 678 | if (_maxCount != maxCount && !self.labels.count) { 679 | _maxCount = maxCount; 680 | [self updateIndex]; 681 | [self setNeedsLayout]; 682 | } 683 | } 684 | 685 | GENERATE_SETTER(index, NSUInteger, setIndex, [self updateIndex]; [self sendActionsForControlEvents:UIControlEventValueChanged];); 686 | 687 | GENERATE_SETTER(trackHeight, CGFloat, setTrackHeight, [self updateDiff];); 688 | GENERATE_SETTER(trackCircleRadius, CGFloat, setTrackCircleRadius, [self updateDiff]; [self updateMaxRadius];); 689 | GENERATE_SETTER(trackColor, UIColor*, setTrackColor, ); 690 | 691 | GENERATE_SETTER(sliderCircleRadius, CGFloat, setSliderCircleRadius, [self updateMaxRadius];); 692 | GENERATE_SETTER(sliderCircleColor, UIColor*, setSliderCircleColor, ); 693 | GENERATE_SETTER(sliderCircleImage, UIImage*, setSliderCircleImage, ); 694 | 695 | GENERATE_SETTER(labelFont, UIFont*, setLabelFont, [self removeLabelLayers];); 696 | GENERATE_SETTER(labelColor, UIColor*, setLabelColor, ); 697 | GENERATE_SETTER(labelOffset, CGFloat, setLabelOffset, ); 698 | GENERATE_SETTER(labelOrientation, StepSliderTextOrientation, setLabelOrientation, ); 699 | GENERATE_SETTER(adjustLabel, BOOL, setAdjustLabel, ); 700 | 701 | @end 702 | -------------------------------------------------------------------------------- /Sources/StepSlider/include/StepSlider.h: -------------------------------------------------------------------------------- 1 | // 2 | // StepSlider.h 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for StepSlider. 12 | FOUNDATION_EXPORT double StepSliderVersionNumber; 13 | 14 | //! Project version string for StepSlider. 15 | FOUNDATION_EXPORT const unsigned char StepSliderVersionString[]; 16 | 17 | /** 18 | * Vertical orientatons of dot labels. 19 | */ 20 | typedef NS_ENUM(NSUInteger, StepSliderTextOrientation) { 21 | /** 22 | * Set text labels below slider. 23 | */ 24 | StepSliderTextOrientationDown, 25 | /** 26 | * Set text labels above slider. 27 | */ 28 | StepSliderTextOrientationUp, 29 | }; 30 | 31 | IB_DESIGNABLE 32 | 33 | @interface StepSlider : UIControl 34 | 35 | /** 36 | * Maximum amount of dots in slider. Must be `2` or greater. 37 | * Note: If `labels` array not empty set `maxCount` to labels count. 38 | */ 39 | @property (nonatomic) IBInspectable NSUInteger maxCount; 40 | 41 | /** 42 | * Currnet selected dot index. 43 | */ 44 | @property (nonatomic) IBInspectable NSUInteger index; 45 | 46 | 47 | /** 48 | * Height of the slider track. 49 | */ 50 | @property (nonatomic) IBInspectable CGFloat trackHeight; 51 | 52 | /** 53 | * Radius of the default dots on slider track. 54 | */ 55 | @property (nonatomic) IBInspectable CGFloat trackCircleRadius; 56 | 57 | /** 58 | * Radius of the slider main wheel. 59 | */ 60 | @property (nonatomic) IBInspectable CGFloat sliderCircleRadius; 61 | 62 | /** 63 | * A Boolean value that determines whether user interaction with dots are ignored. Default value is `YES`. 64 | */ 65 | @property (nonatomic, getter=isDotsInteractionEnabled) IBInspectable BOOL dotsInteractionEnabled; 66 | 67 | 68 | /** 69 | * Color of the slider slider. 70 | */ 71 | @property (nonatomic, strong) IBInspectable UIColor *trackColor; 72 | 73 | /** 74 | * Color of the slider main wheel. 75 | */ 76 | @property (nonatomic, strong) IBInspectable UIColor *sliderCircleColor; 77 | 78 | /** 79 | * Image for slider main wheel. 80 | */ 81 | @property (nonatomic, strong) IBInspectable UIImage *sliderCircleImage; 82 | 83 | /** 84 | * Text for labels that will be show near every dot. 85 | * The text must be an instance of `NSString` or `NSAttributedString`. 86 | * Note: If `labels` array are not empty, then `maxCount` will be equal to `labels.count`. 87 | */ 88 | @property (nonatomic, strong) NSArray *labels; 89 | 90 | /** 91 | * Font of dot labels. 92 | * Can not be `IBInspectable`. http://openradar.appspot.com/21889252 93 | */ 94 | @property (nonatomic, strong) UIFont *labelFont; 95 | 96 | /** 97 | * Color of dot labels. 98 | */ 99 | @property (nonatomic, strong) IBInspectable UIColor *labelColor; 100 | 101 | /** 102 | * Offset between slider and labels. 103 | */ 104 | @property (nonatomic) IBInspectable CGFloat labelOffset; 105 | 106 | /** 107 | * Current vertical orientatons of dot labels. 108 | */ 109 | @property (nonatomic) StepSliderTextOrientation labelOrientation; 110 | 111 | /** 112 | * If `YES` adjust first and last labels to StepSlider frame. And change alingment to left and right. 113 | * Otherwise label position is same as trackCircle, and aligment always is center. 114 | */ 115 | @property (nonatomic) IBInspectable BOOL adjustLabel; 116 | 117 | /** 118 | * Generate haptic feedback when value was changed. Ignored if low power mode is turned on. 119 | * Default value is `false`. 120 | */ 121 | @property (nonatomic) IBInspectable BOOL enableHapticFeedback; 122 | 123 | 124 | /** 125 | * Set the `index` property to parameter value. 126 | * 127 | * @param index The index, that you wanna to be selected. 128 | * @param animated `YES` to animate changing of the `index` property. 129 | */ 130 | - (void)setIndex:(NSUInteger)index animated:(BOOL)animated; 131 | 132 | 133 | /** 134 | * Sets the image to use for track circle for the specified state. 135 | * Currently supported only `UIControlStateNormal` and `UIControlStateSelected`. 136 | * 137 | * @param image The image to use for the specified state. 138 | * @param state The state that uses the specified image. 139 | */ 140 | - (void)setTrackCircleImage:(UIImage *)image forState:(UIControlState)state; 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /StepSlider.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "StepSlider" 3 | s.version = "1.8.0" 4 | s.summary = "StepSlider its custom implementation of slider such as UISlider for preset values. Its based on drawing directly on CAShapeLayer." 5 | s.homepage = "https://github.com/spromicky/StepSlider" 6 | s.screenshots = "https://github.com/spromicky/StepSlider/blob/master/screenshots/example.gif?raw=true" 7 | s.license = 'MIT' 8 | s.author = { "spromicky" => "spromicky@gmail.com" } 9 | s.source = { :git => "https://github.com/spromicky/StepSlider.git", :tag => s.version.to_s } 10 | 11 | s.platform = :ios, '10.0' 12 | s.requires_arc = true 13 | 14 | s.source_files = 'Sources/StepSlider/**/*' 15 | end 16 | -------------------------------------------------------------------------------- /StepSlider.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 015F09F41BCFE4E000CA9E3D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 015F09F31BCFE4E000CA9E3D /* Assets.xcassets */; }; 11 | 01C6885D1BCF98C400DB7828 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 01C6885C1BCF98C400DB7828 /* main.m */; }; 12 | 01C688601BCF98C400DB7828 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 01C6885F1BCF98C400DB7828 /* AppDelegate.m */; }; 13 | 01C688631BCF98C400DB7828 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 01C688621BCF98C400DB7828 /* ViewController.m */; }; 14 | 01C688661BCF98C400DB7828 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01C688641BCF98C400DB7828 /* Main.storyboard */; }; 15 | 01C6886B1BCF98C400DB7828 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 01C688691BCF98C400DB7828 /* LaunchScreen.storyboard */; }; 16 | 427BAD3D253252E00057EE3E /* StepSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 427BAD3C253252E00057EE3E /* StepSlider.h */; }; 17 | 427BAD40253252E80057EE3E /* StepSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 427BAD3F253252E80057EE3E /* StepSlider.m */; }; 18 | 42F0F56E20DD111B0046AF6D /* StepSlider.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42F0F56720DD111B0046AF6D /* StepSlider.framework */; }; 19 | 42F0F56F20DD111C0046AF6D /* StepSlider.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 42F0F56720DD111B0046AF6D /* StepSlider.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 20 | 42F0F57620DD11270046AF6D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42F0F57520DD11270046AF6D /* UIKit.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 42F0F56C20DD111B0046AF6D /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 01C688501BCF98C300DB7828 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 42F0F56620DD111B0046AF6D; 29 | remoteInfo = StepSlider; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXCopyFilesBuildPhase section */ 34 | 42F0F57320DD111C0046AF6D /* Embed Frameworks */ = { 35 | isa = PBXCopyFilesBuildPhase; 36 | buildActionMask = 2147483647; 37 | dstPath = ""; 38 | dstSubfolderSpec = 10; 39 | files = ( 40 | 42F0F56F20DD111C0046AF6D /* StepSlider.framework in Embed Frameworks */, 41 | ); 42 | name = "Embed Frameworks"; 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXCopyFilesBuildPhase section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | 015F09F31BCFE4E000CA9E3D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 01C688581BCF98C300DB7828 /* StepSlider-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "StepSlider-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 01C6885C1BCF98C400DB7828 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 01C6885E1BCF98C400DB7828 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 01C6885F1BCF98C400DB7828 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 01C688611BCF98C400DB7828 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 01C688621BCF98C400DB7828 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 01C688651BCF98C400DB7828 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 01C6886A1BCF98C400DB7828 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 01C6886C1BCF98C400DB7828 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; 58 | 427BAD3C253252E00057EE3E /* StepSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StepSlider.h; path = Sources/StepSlider/include/StepSlider.h; sourceTree = SOURCE_ROOT; }; 59 | 427BAD3F253252E80057EE3E /* StepSlider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StepSlider.m; path = Sources/StepSlider/StepSlider.m; sourceTree = SOURCE_ROOT; }; 60 | 42F0F56720DD111B0046AF6D /* StepSlider.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StepSlider.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 42F0F56A20DD111B0046AF6D /* StepSlider-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "StepSlider-Info.plist"; path = "StepSlider/StepSlider-Info.plist"; sourceTree = ""; }; 62 | 42F0F57520DD11270046AF6D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 63 | 42F0F57A20DD11DD0046AF6D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 01C688551BCF98C300DB7828 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 42F0F56E20DD111B0046AF6D /* StepSlider.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 42F0F56320DD111B0046AF6D /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 42F0F57620DD11270046AF6D /* UIKit.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 01C6884F1BCF98C300DB7828 = { 87 | isa = PBXGroup; 88 | children = ( 89 | 01C6885A1BCF98C300DB7828 /* StepSlider */, 90 | 01C6885B1BCF98C300DB7828 /* Supporting Files */, 91 | 42F0F56820DD111B0046AF6D /* StepSliderFramework */, 92 | 01C688591BCF98C300DB7828 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 01C688591BCF98C300DB7828 /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 01C688581BCF98C300DB7828 /* StepSlider-Example.app */, 100 | 42F0F56720DD111B0046AF6D /* StepSlider.framework */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 01C6885A1BCF98C300DB7828 /* StepSlider */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 01C688771BCF9CB100DB7828 /* res */, 109 | 01C688761BCF9CA900DB7828 /* source */, 110 | ); 111 | path = StepSlider; 112 | sourceTree = ""; 113 | }; 114 | 01C6885B1BCF98C300DB7828 /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 01C6886C1BCF98C400DB7828 /* Info.plist */, 118 | 01C6885C1BCF98C400DB7828 /* main.m */, 119 | ); 120 | name = "Supporting Files"; 121 | path = "StepSlider/Supporting Files"; 122 | sourceTree = ""; 123 | }; 124 | 01C688761BCF9CA900DB7828 /* source */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 42F0F57E20DD1F860046AF6D /* StepSlider */, 128 | 01C688791BCF9CF300DB7828 /* ViewController */, 129 | 01C6885E1BCF98C400DB7828 /* AppDelegate.h */, 130 | 01C6885F1BCF98C400DB7828 /* AppDelegate.m */, 131 | ); 132 | path = source; 133 | sourceTree = ""; 134 | }; 135 | 01C688771BCF9CB100DB7828 /* res */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 01C688781BCF9CBA00DB7828 /* nibs */, 139 | 015F09F31BCFE4E000CA9E3D /* Assets.xcassets */, 140 | ); 141 | path = res; 142 | sourceTree = ""; 143 | }; 144 | 01C688781BCF9CBA00DB7828 /* nibs */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 01C688691BCF98C400DB7828 /* LaunchScreen.storyboard */, 148 | 01C688641BCF98C400DB7828 /* Main.storyboard */, 149 | ); 150 | path = nibs; 151 | sourceTree = ""; 152 | }; 153 | 01C688791BCF9CF300DB7828 /* ViewController */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 01C688611BCF98C400DB7828 /* ViewController.h */, 157 | 01C688621BCF98C400DB7828 /* ViewController.m */, 158 | ); 159 | path = ViewController; 160 | sourceTree = ""; 161 | }; 162 | 42F0F56820DD111B0046AF6D /* StepSliderFramework */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 42F0F57420DD11270046AF6D /* Frameworks */, 166 | 42F0F56A20DD111B0046AF6D /* StepSlider-Info.plist */, 167 | ); 168 | name = StepSliderFramework; 169 | sourceTree = ""; 170 | }; 171 | 42F0F57420DD11270046AF6D /* Frameworks */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 42F0F57A20DD11DD0046AF6D /* QuartzCore.framework */, 175 | 42F0F57520DD11270046AF6D /* UIKit.framework */, 176 | ); 177 | name = Frameworks; 178 | path = ..; 179 | sourceTree = ""; 180 | }; 181 | 42F0F57E20DD1F860046AF6D /* StepSlider */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 427BAD3C253252E00057EE3E /* StepSlider.h */, 185 | 427BAD3F253252E80057EE3E /* StepSlider.m */, 186 | ); 187 | path = StepSlider; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXGroup section */ 191 | 192 | /* Begin PBXHeadersBuildPhase section */ 193 | 42F0F56420DD111B0046AF6D /* Headers */ = { 194 | isa = PBXHeadersBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | 427BAD3D253252E00057EE3E /* StepSlider.h in Headers */, 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXHeadersBuildPhase section */ 202 | 203 | /* Begin PBXNativeTarget section */ 204 | 01C688571BCF98C300DB7828 /* StepSlider-Example */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 01C6886F1BCF98C400DB7828 /* Build configuration list for PBXNativeTarget "StepSlider-Example" */; 207 | buildPhases = ( 208 | 01C688541BCF98C300DB7828 /* Sources */, 209 | 01C688551BCF98C300DB7828 /* Frameworks */, 210 | 01C688561BCF98C300DB7828 /* Resources */, 211 | 42F0F57320DD111C0046AF6D /* Embed Frameworks */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | 42F0F56D20DD111B0046AF6D /* PBXTargetDependency */, 217 | ); 218 | name = "StepSlider-Example"; 219 | productName = StepSlider; 220 | productReference = 01C688581BCF98C300DB7828 /* StepSlider-Example.app */; 221 | productType = "com.apple.product-type.application"; 222 | }; 223 | 42F0F56620DD111B0046AF6D /* StepSlider */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 42F0F57020DD111C0046AF6D /* Build configuration list for PBXNativeTarget "StepSlider" */; 226 | buildPhases = ( 227 | 42F0F56220DD111B0046AF6D /* Sources */, 228 | 42F0F56320DD111B0046AF6D /* Frameworks */, 229 | 42F0F56420DD111B0046AF6D /* Headers */, 230 | 42F0F56520DD111B0046AF6D /* Resources */, 231 | ); 232 | buildRules = ( 233 | ); 234 | dependencies = ( 235 | ); 236 | name = StepSlider; 237 | productName = StepSlider; 238 | productReference = 42F0F56720DD111B0046AF6D /* StepSlider.framework */; 239 | productType = "com.apple.product-type.framework"; 240 | }; 241 | /* End PBXNativeTarget section */ 242 | 243 | /* Begin PBXProject section */ 244 | 01C688501BCF98C300DB7828 /* Project object */ = { 245 | isa = PBXProject; 246 | attributes = { 247 | LastUpgradeCheck = 1200; 248 | ORGANIZATIONNAME = spromicky; 249 | TargetAttributes = { 250 | 01C688571BCF98C300DB7828 = { 251 | CreatedOnToolsVersion = 7.0.1; 252 | DevelopmentTeam = P5HBVTG9QK; 253 | }; 254 | 42F0F56620DD111B0046AF6D = { 255 | CreatedOnToolsVersion = 9.4.1; 256 | ProvisioningStyle = Automatic; 257 | }; 258 | }; 259 | }; 260 | buildConfigurationList = 01C688531BCF98C300DB7828 /* Build configuration list for PBXProject "StepSlider" */; 261 | compatibilityVersion = "Xcode 3.2"; 262 | developmentRegion = en; 263 | hasScannedForEncodings = 0; 264 | knownRegions = ( 265 | en, 266 | Base, 267 | ); 268 | mainGroup = 01C6884F1BCF98C300DB7828; 269 | productRefGroup = 01C688591BCF98C300DB7828 /* Products */; 270 | projectDirPath = ""; 271 | projectRoot = ""; 272 | targets = ( 273 | 01C688571BCF98C300DB7828 /* StepSlider-Example */, 274 | 42F0F56620DD111B0046AF6D /* StepSlider */, 275 | ); 276 | }; 277 | /* End PBXProject section */ 278 | 279 | /* Begin PBXResourcesBuildPhase section */ 280 | 01C688561BCF98C300DB7828 /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 01C6886B1BCF98C400DB7828 /* LaunchScreen.storyboard in Resources */, 285 | 015F09F41BCFE4E000CA9E3D /* Assets.xcassets in Resources */, 286 | 01C688661BCF98C400DB7828 /* Main.storyboard in Resources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 42F0F56520DD111B0046AF6D /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXResourcesBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 01C688541BCF98C300DB7828 /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 01C688631BCF98C400DB7828 /* ViewController.m in Sources */, 305 | 01C688601BCF98C400DB7828 /* AppDelegate.m in Sources */, 306 | 01C6885D1BCF98C400DB7828 /* main.m in Sources */, 307 | ); 308 | runOnlyForDeploymentPostprocessing = 0; 309 | }; 310 | 42F0F56220DD111B0046AF6D /* Sources */ = { 311 | isa = PBXSourcesBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | 427BAD40253252E80057EE3E /* StepSlider.m in Sources */, 315 | ); 316 | runOnlyForDeploymentPostprocessing = 0; 317 | }; 318 | /* End PBXSourcesBuildPhase section */ 319 | 320 | /* Begin PBXTargetDependency section */ 321 | 42F0F56D20DD111B0046AF6D /* PBXTargetDependency */ = { 322 | isa = PBXTargetDependency; 323 | target = 42F0F56620DD111B0046AF6D /* StepSlider */; 324 | targetProxy = 42F0F56C20DD111B0046AF6D /* PBXContainerItemProxy */; 325 | }; 326 | /* End PBXTargetDependency section */ 327 | 328 | /* Begin PBXVariantGroup section */ 329 | 01C688641BCF98C400DB7828 /* Main.storyboard */ = { 330 | isa = PBXVariantGroup; 331 | children = ( 332 | 01C688651BCF98C400DB7828 /* Base */, 333 | ); 334 | name = Main.storyboard; 335 | path = .; 336 | sourceTree = ""; 337 | }; 338 | 01C688691BCF98C400DB7828 /* LaunchScreen.storyboard */ = { 339 | isa = PBXVariantGroup; 340 | children = ( 341 | 01C6886A1BCF98C400DB7828 /* Base */, 342 | ); 343 | name = LaunchScreen.storyboard; 344 | path = .; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXVariantGroup section */ 348 | 349 | /* Begin XCBuildConfiguration section */ 350 | 01C6886D1BCF98C400DB7828 /* Debug */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | ALWAYS_SEARCH_USER_PATHS = NO; 354 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 355 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 356 | CLANG_CXX_LIBRARY = "libc++"; 357 | CLANG_ENABLE_MODULES = YES; 358 | CLANG_ENABLE_OBJC_ARC = YES; 359 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_COMMA = YES; 362 | CLANG_WARN_CONSTANT_CONVERSION = YES; 363 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 364 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 365 | CLANG_WARN_EMPTY_BODY = YES; 366 | CLANG_WARN_ENUM_CONVERSION = YES; 367 | CLANG_WARN_INFINITE_RECURSION = YES; 368 | CLANG_WARN_INT_CONVERSION = YES; 369 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 370 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 371 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 372 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 373 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 374 | CLANG_WARN_STRICT_PROTOTYPES = YES; 375 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 376 | CLANG_WARN_UNREACHABLE_CODE = YES; 377 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 379 | COPY_PHASE_STRIP = NO; 380 | DEBUG_INFORMATION_FORMAT = dwarf; 381 | ENABLE_STRICT_OBJC_MSGSEND = YES; 382 | ENABLE_TESTABILITY = YES; 383 | GCC_C_LANGUAGE_STANDARD = gnu99; 384 | GCC_DYNAMIC_NO_PIC = NO; 385 | GCC_NO_COMMON_BLOCKS = YES; 386 | GCC_OPTIMIZATION_LEVEL = 0; 387 | GCC_PREPROCESSOR_DEFINITIONS = ( 388 | "DEBUG=1", 389 | "$(inherited)", 390 | ); 391 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 392 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 393 | GCC_WARN_UNDECLARED_SELECTOR = YES; 394 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 395 | GCC_WARN_UNUSED_FUNCTION = YES; 396 | GCC_WARN_UNUSED_VARIABLE = YES; 397 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 398 | MTL_ENABLE_DEBUG_INFO = YES; 399 | ONLY_ACTIVE_ARCH = YES; 400 | SDKROOT = iphoneos; 401 | TARGETED_DEVICE_FAMILY = "1,2"; 402 | }; 403 | name = Debug; 404 | }; 405 | 01C6886E1BCF98C400DB7828 /* Release */ = { 406 | isa = XCBuildConfiguration; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 410 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 411 | CLANG_CXX_LIBRARY = "libc++"; 412 | CLANG_ENABLE_MODULES = YES; 413 | CLANG_ENABLE_OBJC_ARC = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INFINITE_RECURSION = YES; 423 | CLANG_WARN_INT_CONVERSION = YES; 424 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 425 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 426 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 427 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 428 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 429 | CLANG_WARN_STRICT_PROTOTYPES = YES; 430 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 431 | CLANG_WARN_UNREACHABLE_CODE = YES; 432 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 433 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 434 | COPY_PHASE_STRIP = NO; 435 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 436 | ENABLE_NS_ASSERTIONS = NO; 437 | ENABLE_STRICT_OBJC_MSGSEND = YES; 438 | GCC_C_LANGUAGE_STANDARD = gnu99; 439 | GCC_NO_COMMON_BLOCKS = YES; 440 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 441 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 442 | GCC_WARN_UNDECLARED_SELECTOR = YES; 443 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 444 | GCC_WARN_UNUSED_FUNCTION = YES; 445 | GCC_WARN_UNUSED_VARIABLE = YES; 446 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 447 | MTL_ENABLE_DEBUG_INFO = NO; 448 | SDKROOT = iphoneos; 449 | TARGETED_DEVICE_FAMILY = "1,2"; 450 | VALIDATE_PRODUCT = YES; 451 | }; 452 | name = Release; 453 | }; 454 | 01C688701BCF98C400DB7828 /* Debug */ = { 455 | isa = XCBuildConfiguration; 456 | buildSettings = { 457 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 458 | CODE_SIGN_IDENTITY = "iPhone Developer"; 459 | DEVELOPMENT_TEAM = P5HBVTG9QK; 460 | INFOPLIST_FILE = StepSlider/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 462 | PRODUCT_BUNDLE_IDENTIFIER = com.StepSlider; 463 | PRODUCT_NAME = "$(TARGET_NAME)"; 464 | }; 465 | name = Debug; 466 | }; 467 | 01C688711BCF98C400DB7828 /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CODE_SIGN_IDENTITY = "iPhone Developer"; 472 | DEVELOPMENT_TEAM = P5HBVTG9QK; 473 | INFOPLIST_FILE = StepSlider/Info.plist; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = com.StepSlider; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | }; 478 | name = Release; 479 | }; 480 | 42F0F57120DD111C0046AF6D /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | buildSettings = { 483 | CLANG_ANALYZER_NONNULL = YES; 484 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 485 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 486 | CLANG_ENABLE_OBJC_WEAK = YES; 487 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 488 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 489 | CODE_SIGN_IDENTITY = ""; 490 | CODE_SIGN_STYLE = Automatic; 491 | CURRENT_PROJECT_VERSION = 1; 492 | DEFINES_MODULE = YES; 493 | DEVELOPMENT_TEAM = ""; 494 | DYLIB_COMPATIBILITY_VERSION = 1; 495 | DYLIB_CURRENT_VERSION = 1; 496 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 497 | GCC_C_LANGUAGE_STANDARD = gnu11; 498 | INFOPLIST_FILE = "StepSlider/StepSlider-Info.plist"; 499 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 500 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 502 | MARKETING_VERSION = 1.8.0; 503 | PRODUCT_BUNDLE_IDENTIFIER = com.spromicky.StepSlider; 504 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 505 | PROVISIONING_PROFILE_SPECIFIER = ""; 506 | SKIP_INSTALL = YES; 507 | TARGETED_DEVICE_FAMILY = "1,2"; 508 | VERSIONING_SYSTEM = "apple-generic"; 509 | VERSION_INFO_PREFIX = ""; 510 | }; 511 | name = Debug; 512 | }; 513 | 42F0F57220DD111C0046AF6D /* Release */ = { 514 | isa = XCBuildConfiguration; 515 | buildSettings = { 516 | CLANG_ANALYZER_NONNULL = YES; 517 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 518 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 519 | CLANG_ENABLE_OBJC_WEAK = YES; 520 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 521 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 522 | CODE_SIGN_IDENTITY = ""; 523 | CODE_SIGN_STYLE = Automatic; 524 | CURRENT_PROJECT_VERSION = 1; 525 | DEFINES_MODULE = YES; 526 | DEVELOPMENT_TEAM = ""; 527 | DYLIB_COMPATIBILITY_VERSION = 1; 528 | DYLIB_CURRENT_VERSION = 1; 529 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 530 | GCC_C_LANGUAGE_STANDARD = gnu11; 531 | INFOPLIST_FILE = "StepSlider/StepSlider-Info.plist"; 532 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 533 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 534 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 535 | MARKETING_VERSION = 1.8.0; 536 | PRODUCT_BUNDLE_IDENTIFIER = com.spromicky.StepSlider; 537 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 538 | PROVISIONING_PROFILE_SPECIFIER = ""; 539 | SKIP_INSTALL = YES; 540 | TARGETED_DEVICE_FAMILY = "1,2"; 541 | VERSIONING_SYSTEM = "apple-generic"; 542 | VERSION_INFO_PREFIX = ""; 543 | }; 544 | name = Release; 545 | }; 546 | /* End XCBuildConfiguration section */ 547 | 548 | /* Begin XCConfigurationList section */ 549 | 01C688531BCF98C300DB7828 /* Build configuration list for PBXProject "StepSlider" */ = { 550 | isa = XCConfigurationList; 551 | buildConfigurations = ( 552 | 01C6886D1BCF98C400DB7828 /* Debug */, 553 | 01C6886E1BCF98C400DB7828 /* Release */, 554 | ); 555 | defaultConfigurationIsVisible = 0; 556 | defaultConfigurationName = Release; 557 | }; 558 | 01C6886F1BCF98C400DB7828 /* Build configuration list for PBXNativeTarget "StepSlider-Example" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | 01C688701BCF98C400DB7828 /* Debug */, 562 | 01C688711BCF98C400DB7828 /* Release */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | 42F0F57020DD111C0046AF6D /* Build configuration list for PBXNativeTarget "StepSlider" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 42F0F57120DD111C0046AF6D /* Debug */, 571 | 42F0F57220DD111C0046AF6D /* Release */, 572 | ); 573 | defaultConfigurationIsVisible = 0; 574 | defaultConfigurationName = Release; 575 | }; 576 | /* End XCConfigurationList section */ 577 | }; 578 | rootObject = 01C688501BCF98C300DB7828 /* Project object */; 579 | } 580 | -------------------------------------------------------------------------------- /StepSlider.xcodeproj/xcshareddata/xcschemes/StepSlider.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 52 | 53 | 59 | 60 | 66 | 67 | 68 | 69 | 71 | 72 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /StepSlider/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarStyle 34 | UIStatusBarStyleLightContent 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIViewControllerBasedStatusBarAppearance 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /StepSlider/StepSlider-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /StepSlider/Supporting Files/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/selected_dot.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "selcted.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/selected_dot.imageset/selcted.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/StepSlider/res/Assets.xcassets/selected_dot.imageset/selcted.pdf -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/thumb.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "thumb.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/thumb.imageset/thumb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/StepSlider/res/Assets.xcassets/thumb.imageset/thumb.pdf -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/unselected_dot.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "unselected.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /StepSlider/res/Assets.xcassets/unselected_dot.imageset/unselected.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/StepSlider/res/Assets.xcassets/unselected_dot.imageset/unselected.pdf -------------------------------------------------------------------------------- /StepSlider/res/nibs/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /StepSlider/res/nibs/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 79 | 87 | 95 | 103 | 104 | 105 | 106 | 107 | 108 | 116 | 124 | 132 | 140 | 141 | 142 | 143 | 144 | 145 | 153 | 161 | 169 | 170 | 171 | 172 | 173 | 174 | 182 | 190 | 198 | 206 | 207 | 208 | 209 | 210 | 211 | 219 | 227 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | -------------------------------------------------------------------------------- /StepSlider/source/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /StepSlider/source/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 14 | return YES; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /StepSlider/source/ViewController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "StepSlider.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | @property (nonatomic, strong) IBOutlet StepSlider *sliderView; 15 | @property (nonatomic, strong) IBOutlet UILabel *label; 16 | 17 | - (IBAction)changeValue:(StepSlider *)sender; 18 | 19 | - (IBAction)changeIndex:(id)sender; 20 | - (IBAction)changeMaxIndex:(id)sender; 21 | - (IBAction)changeTintColor:(id)sender; 22 | - (IBAction)changeSliderCircleColor:(id)sender; 23 | - (IBAction)changeSliderCircleRadius:(id)sender; 24 | - (IBAction)changeTrackColor:(id)sender; 25 | - (IBAction)changeTrackCircleRaidus:(id)sender; 26 | - (IBAction)changeTrackHeight:(id)sender; 27 | - (IBAction)changeTrackCircleImage:(UIButton *)sender; 28 | 29 | - (IBAction)toggleLabels:(UIButton *)sender; 30 | - (IBAction)changeLabelsFont:(id)sender; 31 | - (IBAction)changeLabelsColor:(id)sender; 32 | - (IBAction)changeLabelsOffset:(id)sender; 33 | - (IBAction)changeLabelsOrientation:(id)sender; 34 | - (IBAction)adjustLabels:(UIButton *)sender; 35 | 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /StepSlider/source/ViewController/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // StepSlider 4 | // 5 | // Created by Nick on 10/15/15. 6 | // Copyright © 2015 spromicky. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @implementation ViewController 12 | 13 | - (void)viewDidLoad 14 | { 15 | [super viewDidLoad]; 16 | 17 | [self.label setText:[NSString stringWithFormat:@"Selected index: %lu", (unsigned long)self.sliderView.index]]; 18 | } 19 | 20 | - (IBAction)changeValue:(StepSlider *)sender 21 | { 22 | [self.label setText:[NSString stringWithFormat:@"Selected index: %lu", (unsigned long)sender.index]]; 23 | } 24 | 25 | - (IBAction)changeIndex:(id)sender 26 | { 27 | static NSUInteger flag = 0; 28 | switch (flag % 5) { 29 | case 0: 30 | [self.sliderView setIndex:self.sliderView.maxCount - 1 animated:YES]; 31 | break; 32 | 33 | case 1: 34 | [self.sliderView setIndex:self.sliderView.maxCount / 2 animated:YES]; 35 | break; 36 | 37 | case 2: 38 | [self.sliderView setIndex:self.sliderView.maxCount / 3 animated:YES]; 39 | break; 40 | 41 | case 3: 42 | [self.sliderView setIndex:0 animated:YES]; 43 | break; 44 | 45 | case 4: 46 | [self.sliderView setIndex:1 animated:YES]; 47 | break; 48 | } 49 | flag++; 50 | } 51 | 52 | - (IBAction)changeMaxIndex:(id)sender 53 | { 54 | static NSUInteger flag = 0; 55 | switch (flag % 5) { 56 | case 0: 57 | self.sliderView.maxCount = 19; 58 | break; 59 | 60 | case 1: 61 | self.sliderView.maxCount = 2; 62 | break; 63 | 64 | case 2: 65 | self.sliderView.maxCount = 5; 66 | break; 67 | 68 | case 3: 69 | self.sliderView.maxCount = 8; 70 | break; 71 | 72 | case 4: 73 | self.sliderView.maxCount = 4; 74 | break; 75 | } 76 | flag++; 77 | } 78 | 79 | - (IBAction)changeTintColor:(id)sender 80 | { 81 | static NSUInteger flag = 0; 82 | switch (flag % 5) { 83 | case 0: 84 | self.sliderView.tintColor = [UIColor redColor]; 85 | break; 86 | 87 | case 1: 88 | self.sliderView.tintColor = [UIColor blueColor]; 89 | break; 90 | 91 | case 2: 92 | self.sliderView.tintColor = [UIColor grayColor]; 93 | break; 94 | 95 | case 3: 96 | self.sliderView.tintColor = [UIColor yellowColor]; 97 | break; 98 | 99 | case 4: 100 | self.sliderView.tintColor = [UIColor magentaColor]; 101 | break; 102 | } 103 | flag++; 104 | } 105 | 106 | - (IBAction)changeSliderCircleColor:(id)sender 107 | { 108 | static NSUInteger flag = 0; 109 | switch (flag % 5) { 110 | case 0: 111 | self.sliderView.sliderCircleColor = [UIColor redColor]; 112 | break; 113 | 114 | case 1: 115 | self.sliderView.sliderCircleColor = [UIColor blueColor]; 116 | break; 117 | 118 | case 2: 119 | self.sliderView.sliderCircleColor = [UIColor grayColor]; 120 | break; 121 | 122 | case 3: 123 | self.sliderView.sliderCircleColor = [UIColor yellowColor]; 124 | break; 125 | 126 | case 4: 127 | self.sliderView.sliderCircleColor = [UIColor magentaColor]; 128 | break; 129 | } 130 | flag++; 131 | } 132 | 133 | - (IBAction)changeTrackColor:(id)sender 134 | { 135 | static NSUInteger flag = 0; 136 | switch (flag % 5) { 137 | case 0: 138 | self.sliderView.trackColor = [UIColor redColor]; 139 | break; 140 | 141 | case 1: 142 | self.sliderView.trackColor = [UIColor blueColor]; 143 | break; 144 | 145 | case 2: 146 | self.sliderView.trackColor = [UIColor grayColor]; 147 | break; 148 | 149 | case 3: 150 | self.sliderView.trackColor = [UIColor yellowColor]; 151 | break; 152 | 153 | case 4: 154 | self.sliderView.trackColor = [UIColor magentaColor]; 155 | break; 156 | } 157 | flag++; 158 | } 159 | 160 | - (IBAction)changeSliderCircleRadius:(id)sender 161 | { 162 | static NSUInteger flag = 0; 163 | switch (flag % 5) { 164 | case 0: 165 | self.sliderView.sliderCircleRadius = 0.f; 166 | break; 167 | 168 | case 1: 169 | self.sliderView.sliderCircleRadius = self.sliderView.trackHeight; 170 | break; 171 | 172 | case 2: 173 | self.sliderView.sliderCircleRadius = self.sliderView.trackHeight * 2.f; 174 | break; 175 | 176 | case 3: 177 | self.sliderView.sliderCircleRadius = self.sliderView.trackCircleRadius; 178 | break; 179 | 180 | case 4: 181 | self.sliderView.sliderCircleRadius = self.sliderView.trackCircleRadius * 2.f; 182 | break; 183 | } 184 | flag++; 185 | } 186 | 187 | - (IBAction)changeTrackCircleRaidus:(id)sender 188 | { 189 | static NSUInteger flag = 0; 190 | switch (flag % 5) { 191 | case 0: 192 | self.sliderView.trackCircleRadius = 0.f; 193 | break; 194 | 195 | case 1: 196 | self.sliderView.trackCircleRadius = self.sliderView.trackHeight; 197 | break; 198 | 199 | case 2: 200 | self.sliderView.trackCircleRadius = self.sliderView.trackHeight * 2.f; 201 | break; 202 | 203 | case 3: 204 | self.sliderView.trackCircleRadius = self.sliderView.sliderCircleRadius; 205 | break; 206 | 207 | case 4: 208 | self.sliderView.trackCircleRadius = self.sliderView.sliderCircleRadius * 2.f; 209 | break; 210 | } 211 | flag++; 212 | } 213 | 214 | - (IBAction)changeTrackHeight:(id)sender 215 | { 216 | static NSUInteger flag = 0; 217 | switch (flag % 5) { 218 | case 0: 219 | self.sliderView.trackHeight = 0.f; 220 | break; 221 | 222 | case 1: 223 | self.sliderView.trackHeight = 2.f; 224 | break; 225 | 226 | case 2: 227 | self.sliderView.trackHeight = 10.f; 228 | break; 229 | 230 | case 3: 231 | self.sliderView.trackHeight = self.sliderView.bounds.size.height; 232 | break; 233 | 234 | case 4: 235 | self.sliderView.trackHeight = self.sliderView.bounds.size.height * 2.f; 236 | break; 237 | } 238 | flag++; 239 | } 240 | 241 | - (IBAction)toggleLabels:(UIButton *)sender 242 | { 243 | static NSUInteger flag = 0; 244 | switch (flag % 3) { 245 | case 0: 246 | self.sliderView.labels = @[@"First", @"Second", @"Third"]; 247 | break; 248 | case 1: 249 | self.sliderView.labels = @[@"1", @"2", @"3", @"4", @"5"]; 250 | break; 251 | case 2: 252 | self.sliderView.labels = nil; 253 | break; 254 | } 255 | flag++; 256 | } 257 | 258 | - (IBAction)toggleAttributedLabels:(UIButton *)sender 259 | { 260 | static NSUInteger flag = 0; 261 | switch (flag % 2) { 262 | case 0: 263 | { 264 | NSAttributedString *secondString = [[NSMutableAttributedString alloc] initWithString:@"Second" attributes:@{NSFontAttributeName: [UIFont fontWithName:@"Menlo" size:20.f]}]; 265 | NSMutableAttributedString *thirdString = [[NSMutableAttributedString alloc] initWithString:@"Third" attributes:@{NSForegroundColorAttributeName: [UIColor colorWithRed:0.90f green:0.64f blue:0.45f alpha:1.f]}]; 266 | 267 | self.sliderView.labels = @[@"First", secondString, thirdString]; 268 | break; 269 | } 270 | case 1: 271 | self.sliderView.labels = nil; 272 | break; 273 | } 274 | flag++; 275 | } 276 | 277 | - (IBAction)changeLabelsFont:(id)sender 278 | { 279 | static NSUInteger flag = 0; 280 | switch (flag % 4) { 281 | case 0: 282 | self.sliderView.labelFont = [UIFont systemFontOfSize:10.f weight:UIFontWeightThin]; 283 | break; 284 | case 1: 285 | self.sliderView.labelFont = [UIFont boldSystemFontOfSize:15.f]; 286 | break; 287 | case 2: 288 | self.sliderView.labelFont = [UIFont italicSystemFontOfSize:20.f]; 289 | break; 290 | case 3: 291 | self.sliderView.labelFont = [UIFont systemFontOfSize:15.f]; 292 | break; 293 | } 294 | flag++; 295 | } 296 | 297 | - (IBAction)changeLabelsColor:(id)sender 298 | { 299 | static NSUInteger flag = 0; 300 | switch (flag % 3) { 301 | case 0: 302 | self.sliderView.labelColor = [UIColor greenColor]; 303 | break; 304 | case 1: 305 | self.sliderView.labelColor = [UIColor redColor]; 306 | break; 307 | case 2: 308 | self.sliderView.labelColor = [UIColor whiteColor]; 309 | break; 310 | } 311 | flag++; 312 | } 313 | 314 | - (IBAction)changeLabelsOffset:(id)sender 315 | { 316 | static NSUInteger flag = 0; 317 | switch (flag % 3) { 318 | case 0: 319 | self.sliderView.labelOffset = 0.f; 320 | break; 321 | case 1: 322 | self.sliderView.labelOffset = 50.f; 323 | break; 324 | case 2: 325 | self.sliderView.labelOffset = 20.f; 326 | break; 327 | } 328 | flag++; 329 | } 330 | 331 | - (IBAction)changeLabelsOrientation:(id)sender 332 | { 333 | static NSUInteger flag = 1; 334 | self.sliderView.labelOrientation = flag % 2; 335 | flag++; 336 | } 337 | 338 | - (IBAction)adjustLabels:(UIButton *)sender 339 | { 340 | sender.selected = !sender.selected; 341 | self.sliderView.adjustLabel = sender.selected; 342 | } 343 | 344 | - (IBAction)changeSliderCircleImage:(UIButton *)sender 345 | { 346 | sender.selected = !sender.selected; 347 | self.sliderView.sliderCircleImage = sender.selected ? [UIImage imageNamed:@"thumb"] : nil; 348 | } 349 | 350 | 351 | - (IBAction)changeTrackCircleImage:(UIButton *)sender 352 | { 353 | sender.selected = !sender.selected; 354 | [self.sliderView setTrackCircleImage:sender.selected ? [UIImage imageNamed:@"unselected_dot"] : nil forState:UIControlStateNormal]; 355 | [self.sliderView setTrackCircleImage:sender.selected ? [UIImage imageNamed:@"selected_dot"] : nil forState:UIControlStateSelected]; 356 | } 357 | 358 | - (IBAction)enableHaptic:(UIButton *)sender 359 | { 360 | sender.selected = !sender.selected; 361 | self.sliderView.enableHapticFeedback = sender.selected; 362 | } 363 | 364 | @end 365 | -------------------------------------------------------------------------------- /screenshots/attributedString.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/screenshots/attributedString.png -------------------------------------------------------------------------------- /screenshots/example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/screenshots/example.gif -------------------------------------------------------------------------------- /screenshots/example_labels.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/screenshots/example_labels.gif -------------------------------------------------------------------------------- /screenshots/images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spromicky/StepSlider/0835ce78cd17c5f1d5c3485fe3f0286b263513bf/screenshots/images.png --------------------------------------------------------------------------------