在交换机中未处理枚举值'UIGestureRecognizerStatePossible','UIGestureRecognizerStateCancelled'和'UIGestureRecognizerStateFailed'

时间:2012-07-23 06:53:21

标签: objective-c ios5 xcode4.2

当我使用手势功能进行上下翻转时,这有助于修复此错误

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

}

1 个答案:

答案 0 :(得分:18)

警告中列出的值没有case。添加以下内容以使警告静音:

default:
    break;