错误消息:在交换机中未处理枚举值'GameMoveNineEnum'?

时间:2013-01-21 19:16:30

标签: xcode enums switch-statement semantics

我发现问题很接近,但没有任何帮助,任何人都可以看到我为什么要纠正这个错误吗?它有一个问题“(移动)”代码的第6行。感谢

// move the spirit left/right/up/down
-(BOOL)moveSpiritWidthOrientation:(GameSpirit*)spirit moveEnum:(GameMoveEnum)move setTransform:(BOOL)trans{
    CGPoint gridPoint = [self getGridPointWithPoint:spirit.endPoint];
    CGAffineTransform transform = CGAffineTransformIdentity;
    switch (move) {
        case GameMoveTopEnum:
            gridPoint.y -= 1;
            transform = CGAffineTransformMakeRotation(-M_PI/2);
            break;
        case GameMoveBottomEnum:
            gridPoint.y += 1;
            transform = CGAffineTransformMakeRotation(M_PI/2);
            break;
        case GameMoveLeftEnum:
            gridPoint.x -= 1;
            transform = CGAffineTransformMakeScale(-1, 1);
            break;
        case GameMoveRightEnum:
            gridPoint.x += 1;
            break;
    }

1 个答案:

答案 0 :(得分:7)

使用default。即使default: break;也可以。