I've tried following the advice on a couple of other threads, but their approaches do not seem to work in this instance. Here is my situation:
I have 2 scroll views. "Scroll view A" has a label that fades in and out when scrolling "Scroll View A". When "Scroll View B" is dragged I want to immediately hide the label on "Scroll View A". However I cannot interrupt the label's slow fade out animation. Here are the two methods I'm using:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if (scrollView.tag != 1)
{
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState animations:^{
self.liveOverlayLabel.alpha = .6;
} completion:^(BOOL finished) {
}];
}
else
{
[UIView animateWithDuration:0 delay:0 options:UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState animations:^{
self.liveOverlayLabel.alpha = 0;
} completion:^(BOOL finished) {
self.liveOverlayLabel.alpha = 0;
}];
}
}
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
if (scrollView.tag != 1)
{
NSLog(@"stoppping");
[UIView animateWithDuration:5 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.liveOverlayLabel.alpha = 0;
} completion:^(BOOL finished) {
}];
}
else
{
self.liveOverlayLabel.alpha = 0;
}
}