Permalink
Browse files

Slightly improved scroll indicator appearance while dragging.

  • Loading branch information...
1 parent dc4642b commit 62891799156f4e3933e5c37aeab3e941ec9911a8 @matej committed Jul 17, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 MBPullDownController/MBPullDownController.m
View
9 MBPullDownController/MBPullDownController.m
@@ -369,16 +369,23 @@ - (void)unregisterFromScrollViewKVO:(UIScrollView *)scrollView {
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:@"contentOffset"]) {
+ UIScrollView *scrollView = object;
if (!self.adjustedScroll) {
CGPoint oldValue = [[change valueForKey:NSKeyValueChangeOldKey] CGPointValue];
CGPoint newValue = [[change valueForKey:NSKeyValueChangeNewKey] CGPointValue];
CGPoint adjusted = newValue;
+ // Hide the scroll indicator while dragging
+ if (!scrollView.decelerating && (self.open || newValue.y < -self.closedTopOffset)) {
+ scrollView.showsVerticalScrollIndicator = NO;
+ } else {
+ scrollView.showsVerticalScrollIndicator = YES;
+ }
// Simulate the scroll view elasticity effect while dragging in the open state
if (self.open && [self scrollView].dragging) {
CGFloat delta = roundf((oldValue.y - newValue.y) / 3);
adjusted = CGPointMake(newValue.x, oldValue.y - delta);
self.adjustedScroll = YES; // prevent infinite recursion
- [self scrollView].contentOffset = adjusted;
+ scrollView.contentOffset = adjusted;
}
[self updateBackgroundViewForScrollOfset:adjusted];
} else {

0 comments on commit 6289179

Please sign in to comment.