Totumus Maximus
Totumus Maximus

Reputation: 7573

stopping scrollview animation when below a certain speed

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---//

Upvotes: 0

Views: 609

Answers (2)

Totumus Maximus
Totumus Maximus

Reputation: 7573

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

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

Upvotes: 1

bitmapdata.com
bitmapdata.com

Reputation: 9600

#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;
}

Upvotes: 1

Related Questions