0

I have this app with a UIScrollView on it. On the scrollView I have multiple tabs. Each of those tabs I would like to drag down so I can show another View on those tabs.

The problem is, I can't drag the tabs down while the uiscrollview is still scrolling. The idea is to make the scrollview stop moving when the decelerationrate is below a certain speed so I can access the tabs earlier so the user doesn't have to wait.

Does anyone have a clue how to stop the deceleration (stop the scrollbar movement entirely) of the uiscrollbar when at a certain speed of deceleration or below?

Your help will be kindly appreciated.

//---Edited for clarity---//

Totumus Maximus
  • 7,543
  • 6
  • 45
  • 69

2 Answers2

1
#define SCROLL_DECELERATION_FACTOR 2.0 

- (void)viewDidLoad
{
    [super viewDidLoad];

    float decel = UIScrollViewDecelerationRateNormal - (UIScrollViewDecelerationRateNormal - UIScrollViewDecelerationRateFast)/SCROLL_DECELERATION_FACTOR;
    self.scrollView.decelerationRate = decel;
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{

}

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
{

}


- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{


}

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

   scrollView.userInteractionEnabled = NO;

}

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{

}


- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{

    scrollView.userInteractionEnabled = YES;
}
bitmapdata.com
  • 9,572
  • 5
  • 35
  • 43
  • This does make the decelaration rate faster but i'd like it to stop. immidiately. This function also makes scrolling less comfortable for a user. The problem here is that the tabs won't react until the scrollbar has stopped moving. – Totumus Maximus Oct 05 '11 at 14:36
  • I appreciate your thoughts but I don't want to access the tabs while the UIScrollView is moving. I only want the visible tabs to be accessable when the scrollview has stopped moving alltogether. The default scrollview takes ages to stop moving, its speed of scrolling at start is nice and i want to keep that speed until it has reached below a certain velocity. When it reached that velocity it needs to stop moving (like a snap but not like paging and the likes). It's easy to log the speed when scrolling but I can't get it to stop when I need it to. – Totumus Maximus Oct 05 '11 at 15:14
1

How to know exactly when a UIScrollView's scrolling has stopped?

This question leads to the answer here. Thank you for the effort nonetheless

Community
  • 1
  • 1
Totumus Maximus
  • 7,543
  • 6
  • 45
  • 69