Skip to content

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

License

Notifications You must be signed in to change notification settings

JonasGessner/JGDetailScrubber

Repository files navigation

JGDetailScrubber

© 2013-2014 Jonas Gessner


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'

OR:

Add source Files:
1. Add the `JGDetailScrubber` folder to your Xcode Project.
2. `#import "JGDetailScrubber.h"`.

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.


###JGDetailScrubberDelegate
@property (nonatomic, weak) id <JGDetailScrubberDelegate> delegate;

`JGScrubberDelegate` has one (optional) method:
- (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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published