Inherits from NSObject
Conforms to UICollectionViewDelegate
UIScrollViewDelegate
UITableViewDelegate
Declared in SPTScrollViewScrubberController.h

Overview

Instances of SPTScrollViewScrubberController control a scrubber view to quickly scroll through an UIScrollView or any of its subclasses like UITableView or UICollectionView.

It was inspired by NSScreencast episode 97: Scrolling Nub (11/28/2013).

UIScrollViewDelegate

It is not necessary that SPTScrollViewController instances are the delegate of the scroll view as long as the following delegate callbacks get passed through:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView

And additionally these if zooming is enabled for the scroll view:

-(void)scrollViewDidZoom:(UIScrollView *)scrollView
-(void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
-(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale

Properties

scrollView

The instance of UIScrollView or any of its subclasses to be used with the scrubber.

@property (nonatomic, strong) IBOutlet UIScrollView *scrollView

Discussion

The instance of UIScrollView or any of its subclasses to be used with the scrubber.

Declared In

SPTScrollViewScrubberController.h

scrubberView

A UIView instance or any of its subclasses to be used as the scrubber.

@property (nonatomic, strong) IBOutlet UIView *scrubberView

Discussion

A UIView instance or any of its subclasses to be used as the scrubber.

This view will be added as a subview to the scrollView object, if it has not already been added. The default is a simple 30x30 view with red background color and a corner radius of 15 which results in red dot.

Warning: There must not be any autolayout constraints affecting its layout.

Declared In

SPTScrollViewScrubberController.h

horizontalScrubbing

A Boolean value that determines whether the scrubber should be used for horizontal scrolling.

@property (nonatomic, assign) BOOL horizontalScrubbing

Discussion

A Boolean value that determines whether the scrubber should be used for horizontal scrolling.

The default value is NO.

Declared In

SPTScrollViewScrubberController.h

verticalScrubbing

A Boolean value that determines whether the scrubber should be used for vertical scrolling.

@property (nonatomic, assign) BOOL verticalScrubbing

Discussion

A Boolean value that determines whether the scrubber should be used for vertical scrolling.

The default value is YES.

Declared In

SPTScrollViewScrubberController.h

minimumHorizontalScrollFactor

The minimum factor the content views width must be larger than the scroll views content areas width at which the scrubber can be used for horizontal scrolling.

@property (nonatomic, assign) CGFloat minimumHorizontalScrollFactor

Discussion

The minimum factor the content views width must be larger than the scroll views content areas width at which the scrubber can be used for horizontal scrolling.

The scroll views content area is determined by adjusting its bounds by its content insets. The minimumHorizontalScrollFactor must be greater than 1.0. The default value is 2.0.

Declared In

SPTScrollViewScrubberController.h

minimumVerticalScrollFactor

The minimum factor the content views height must be larger than the scroll views content areas height at which the scrubber can be used for vertical scrolling.

@property (nonatomic, assign) CGFloat minimumVerticalScrollFactor

Discussion

The minimum factor the content views height must be larger than the scroll views content areas height at which the scrubber can be used for vertical scrolling.

The scroll views content area is determined by adjusting its bounds by its content insets. The minimumVerticalScrollFactor must be greater than 1.0. The default value is 2.0.

Declared In

SPTScrollViewScrubberController.h

edgeInsets

The minimum distance the scrubber view is inset from the enclosing scroll view.

@property (nonatomic, assign) UIEdgeInsets edgeInsets

Discussion

The minimum distance the scrubber view is inset from the enclosing scroll view.

The default value is {10.0,10.0,10.0,10.0}.

Declared In

SPTScrollViewScrubberController.h

horizontalAlignment

The alignment mode for the horizontal axis.

@property (nonatomic, assign) SPTScrollViewScrubberAlignment horizontalAlignment

Discussion

The alignment mode for the horizontal axis.

The scrubber view is aligned according to this value if it is not used for horizontal scrolling or if the scrollable area is not large enough. The default value is SPTScrollViewScrubberAlignmentNone.

Declared In

SPTScrollViewScrubberController.h

verticalAlignment

The alignment mode for the vertical axis.

@property (nonatomic, assign) SPTScrollViewScrubberAlignment verticalAlignment

Discussion

The alignment mode for the vertical axis.

The scrubber view is aligned according to this value if it is not used for vertical scrolling or if the scrollable area is not large enough. The default value is SPTScrollViewScrubberAlignmentNone.

Declared In

SPTScrollViewScrubberController.h

hideWhileZooming

A Boolean value that determines if the scrubber view should be hidden while the user performs a zoom gesture.

@property (nonatomic, assign) BOOL hideWhileZooming

Discussion

A Boolean value that determines if the scrubber view should be hidden while the user performs a zoom gesture.

The default value is YES.

Declared In

SPTScrollViewScrubberController.h

selectOnContentSizeChange

A Boolean value that determines if the scrubber view should be selected when the scroll views content size changes.

@property (nonatomic, assign) BOOL selectOnContentSizeChange

Discussion

A Boolean value that determines if the scrubber view should be selected when the scroll views content size changes.

The default value is YES.

Declared In

SPTScrollViewScrubberController.h

selectOnAnyContentOffsetChange

A Boolean value that determines if the scrubber view should be selected when the scroll views content offset changes for any reason.

@property (nonatomic, assign) BOOL selectOnAnyContentOffsetChange

Discussion

A Boolean value that determines if the scrubber view should be selected when the scroll views content offset changes for any reason.

If this value is NO the scrubber view will only be selected if content offset changes have been caused by a drag gesture. Otherwise the scrubber gets selected for any change of the scroll position, e.g. status bar taps, programmatically changes to the content offset, or content size being shrinked.

The default value is YES.

Declared In

SPTScrollViewScrubberController.h

highlightScrubberView

A block which changes properties of the scrubber view to highlight it.

@property (nonatomic, copy) void ( ^ ) ( UIView *view ) highlightScrubberView

Discussion

A block which changes properties of the scrubber view to highlight it.

This is called when the scrubbing property changes to YES, i.e. a drag operation on the scrubber view begins. The default block sets the views highlighted property if it responds to -setHighlighted:.

Declared In

SPTScrollViewScrubberController.h

unhighlightScrubberView

A block which changes properties of the scrubber view to unhighlight it.

@property (nonatomic, copy) void ( ^ ) ( UIView *view ) unhighlightScrubberView

Discussion

A block which changes properties of the scrubber view to unhighlight it.

This is called when the scrubbing property changes to NO, i.e. a drag operation on the scrubber view ends. The default block unsets the views highlighted propertxy if it responds to -setHighlighted:.

Declared In

SPTScrollViewScrubberController.h

selectScrubberView

A block which changes properties of the scrubber view to select it.

@property (nonatomic, copy) void ( ^ ) ( UIView *view ) selectScrubberView

Discussion

A block which changes properties of the scrubber view to select it.

This is used in select animation or called directly when the view needs to selected immediatly. The default block sets the scrubber views alpha value to 1.0 and sets the views selected property if it responds to -setSelected:.

Declared In

SPTScrollViewScrubberController.h

deselectScrubberView

A block which changes properties of the scrubber view to unselect it.

@property (nonatomic, copy) void ( ^ ) ( UIView *view ) deselectScrubberView

Discussion

A block which changes properties of the scrubber view to unselect it.

This is used in unselect animation. The default block sets the scrubber views alpha value to 0.3 and unsets its selected property if it responds to -setSelected:.

Declared In

SPTScrollViewScrubberController.h

deselectDelay

The time interval by which the unselection gets delayed after scrolling.

@property (nonatomic, assign) NSTimeInterval deselectDelay

Discussion

The time interval by which the unselection gets delayed after scrolling.

The default value is 0.75 seconds.

Declared In

SPTScrollViewScrubberController.h

deselectAnimationDuration

A time interval value that determines the duration of deselect animations.

@property (nonatomic, assign) NSTimeInterval deselectAnimationDuration

Discussion

A time interval value that determines the duration of deselect animations.

The default value is 0.5 seconds.

Declared In

SPTScrollViewScrubberController.h

scrubbing

A Boolean value that determines if the user is currently dragging the scrubber view.

@property (nonatomic, readonly, getter=isScrubbing) BOOL scrubbing

Discussion

A Boolean value that determines if the user is currently dragging the scrubber view.

Declared In

SPTScrollViewScrubberController.h

scrubberViewSelected

A Boolean value that determines if the scrubber view is currently selected.

@property (nonatomic, readonly, getter=isScrubberViewSelected) BOOL scrubberViewSelected

Discussion

A Boolean value that determines if the scrubber view is currently selected.

Declared In

SPTScrollViewScrubberController.h

Instance Methods

flashScrubberView

Flashes the scrubber view by selecting immediately and deselecting it animated.

- (void)flashScrubberView

Discussion

Flashes the scrubber view by selecting immediately and deselecting it animated.

This method has no effect if the scrubber view is selected.

Declared In

SPTScrollViewScrubberController.h