HUBViewControllerScrollHandler
@protocol HUBViewControllerScrollHandler <NSObject>
Protocol used to define custom scroll handlers for Hub Framework view controllers
Each feature can supply a scroll handler when it’s being registered with the Hub Framework
(through HUBFeatureRegistry). This enables a feature to customize how scrolling is handled
for all view controllers that will be created on its behalf.
-
Return whether scroll indicators should be shown in a view controller
The Hub Framework will call this method when a view controller is being set up. The returned value will be used for both horizontal & vertical scroll indicators.
Declaration
Objective-C
- (BOOL)shouldShowScrollIndicatorsInViewController: (HUBViewController *)viewController;Parameters
viewControllerThe view controller in question
-
Return whether the system’s automatic adjustment of content insets should be used for a view controller
The Hub Framework will call this method when a view controller is being set up. The returned value will be assigned to its
automaticallyAdjustsScrollViewInsetsproperty, so see the documentation for that property onUIViewControllerfor more information.Declaration
Objective-C
- (BOOL)shouldAutomaticallyAdjustContentInsetsInViewController: (HUBViewController *)viewController;Parameters
viewControllerThe view controller in question
-
Return the deceleration rate to use for scrolling in a view controller
The Hub Framework will call this method when a view controller is being set up. The returned value will be assied to the
decelerationRateproperty of its internal scroll view.Declaration
Objective-C
- (CGFloat)scrollDecelerationRateForViewController: (HUBViewController *)viewController;Parameters
viewControllerThe view controller in question
-
Return the content insets to use for a view controller
The Hub Framework will call this method every time a view controller is being laid out, which is usually in response to that its view model has been changed. The returned value will be assigned to the
contentInsetproperty of its internal scroll view.Declaration
Objective-C
- (UIEdgeInsets) contentInsetsForViewController:(HUBViewController *)viewController proposedContentInsets:(UIEdgeInsets)proposedContentInsets;Parameters
viewControllerThe view controller in question
proposedContentInsetsThe content insets that the Hub Framework is proposing will be used, which is computed in regards to the view’s current navigation bar height and the status bar height of the app.
-
React to that a scrolling event started in a view controller
Declaration
Objective-C
- (void)scrollingWillStartInViewController:(HUBViewController *)viewController currentContentRect:(CGRect)currentContentRect;Parameters
viewControllerThe view controller in question
currentContentRectThe rectangle of the currently visible content in the view controller’s scroll view
-
React to that a scrolling event ended in a view controller
Declaration
Objective-C
- (void)scrollingDidEndInViewController:(HUBViewController *)viewController currentContentRect:(CGRect)currentContentRect;Parameters
viewControllerThe view controller in question
currentContentRectThe rectangle of the currently visible content in the view controller’s scroll view
-
-targetContentOffsetForEndedScrollInViewController:velocity:contentInset:currentContentOffset:proposedContentOffset:Return the target content offset for when scrolling ended in a view controller
Declaration
Objective-C
- (CGPoint) targetContentOffsetForEndedScrollInViewController: (HUBViewController *)viewController velocity:(CGVector)velocity contentInset:(UIEdgeInsets)contentInset currentContentOffset:(CGPoint)currentContentOffset proposedContentOffset: (CGPoint)proposedContentOffset;Parameters
viewControllerThe view controller in question
velocityThe current scrolling velocity
contentInsetThe current content inset of the view controller’s scroll view
currentContentOffsetThe current scrolling content offset
proposedContentOffsetThe target content offset that the Hub Framework is proposing will be used
-
Return the content offset for displaying a component at a certain scroll position.
Declaration
Objective-C
- (CGPoint) contentOffsetForDisplayingComponentAtIndex:(NSUInteger)componentIndex scrollPosition:(HUBScrollPosition)scrollPosition contentInset:(UIEdgeInsets)contentInset contentSize:(CGSize)contentSize viewController:(HUBViewController *)viewController;Parameters
componentIndexThe index of the component to display.
scrollPositionThe position to display the component at.
contentInsetThe current content inset of the view controller’s scroll view
contentSizeThe current content size of the view controller’s scroll view
viewControllerThe view controller in question.
View on GitHub
Install in Dash
HUBViewControllerScrollHandler Protocol Reference