JGDetailScrubber

UISlider subclass with variable scrubbing speeds. Inspired by the iOS Music app.

MIT License

Stars
36
Committers
1

JGDetailScrubber is a UISlider subclass with variable scrubbing speeds, similar to the private class MPDetailScrubber.

Requirements

• Deployment Target: iOS 5.0 or higher • Built with ARC (If your Xcode project doesn't use ARC then set the -fobjc-arc compiler flag) • Foundation, UIKit and CoreGraphics frameworks

Setup

CocoaPods: Add this to your Podfile:

pod 'JGDetailScrubber', '1.0'

Usage

JGDetailScrubber works like a normal UISlider, with the addition of variable scrubbing speeds for fine adjusting the slider value.

@property (nonatomic, strong) NSDictionary *scrubbingSpeeds;

Use this property to set up scrubbing. The dictionary contains the Y-offsets from the slider as keys for the scrubbing speeds. The default value of is:

@{@(0.0f)   : @(1.0f),
  @(50.0f)  : @(0.5f),
  @(100.0f) : @(0.25f),
  @(150.0f) : @(0.1f)};
@property (nonatomic, assign, readonly) CGFloat currentScrubbingSpeed;

Returns the current scrubbing speed. If tracking is NO then the returned value will be 0.0f.

@property (nonatomic, assign, readonly) BOOL scrubbing;

Returns YES if the scrubber is currently scrubbing and NO if it isn't.

@property (nonatomic, weak) id <JGDetailScrubberDelegate> delegate;
- (void)scrubber:(JGDetailScrubber *)slider didChangeToScrubbingSpeed:(CGFloat)speed;

This method is called whenever the scrubber's currentScrubbingSpeed changes.

Credits

Created by Jonas Gessner. ©2013-2014

License

JGDetailScrubber is available under the MIT license.

Package Rankings
Top 13.02% on Cocoapods.org
Related Projects