Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enumeration values 'UIGestureRecognizerStatePossible', 'UIGestureRecognizerStateCancelled', and 'UIGestureRecognizerStateFailed' not handled in switch

When i using gesture functionality for flip up and down this is occurred kindly help to fix this error

- (void)doFlipForward:(UIGestureRecognizer *)aGestureRecognizer forOrientation:(UIInterfaceOrientation)anOrientation{
    if(isAnimating)
    return;

switch([aGestureRecognizer state])//There is occurred in this line
{
    case UIGestureRecognizerStateBegan:
        [CATransaction begin];
        [CATransaction setDisableActions:YES];
        [flipPage setHidden:NO];
        [flipShadow setHidden:NO];
        [CATransaction commit];         
        break;

    case UIGestureRecognizerStateChanged:
    {
        CGFloat multiplier = 0.0f;
        if(UIInterfaceOrientationIsPortrait(anOrientation))
        {
            multiplier = portraitMultiplierTable[(NSInteger)[aGestureRecognizer locationInView:self].x];
            [thisPage setPortraitCurlAnimationPosition:multiplier];
            [flipPage setPortraitCurlAnimationPosition:multiplier];
            [flipShadow setPortraitCurlAnimationPosition:multiplier];
        }
        else
        {
            multiplier = landscapeMultiplierTable[(NSInteger)[aGestureRecognizer locationInView:self].x];
            [thisPage setLandscapeCurlAnimationPosition:multiplier];
            [flipPage setLandscapeCurlAnimationPosition:multiplier];
            [flipShadow setLandscapeCurlAnimationPosition:multiplier];
        }
    }
        break;

    case UIGestureRecognizerStateEnded:
    {
        CGFloat transX = [(UIPanGestureRecognizer *)aGestureRecognizer translationInView:self].x;

        CGFloat width = [self bounds].size.height * PAGE_RATIO;
        if(width + transX < width/2)
        {
            [self animateOpen];
        }
        else
        {
            [self animateClose];
        }
    }           
        break;
}

}

like image 432
SAS Sudalaiyandi Avatar asked Nov 30 '25 05:11

SAS Sudalaiyandi


1 Answers

You don't have a case for the listed values in the warning. Add the following to silence the warning:

default:
    break;
like image 99
borrrden Avatar answered Dec 02 '25 21:12

borrrden



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!