目标C切换问题

时间:2009-11-30 10:24:57

标签: objective-c

我的代码看起来像这样:

-(void)touchBegan:(HWPoint *)point {  
    switch (self.states) {  
        case HWDrawState:  
            HWShape *shape = [[HWShapeManager sharedInstance]  addShapeWithType:_shapeClass];  
            break;  
        case HWSelectState:  
            break;  
        case HWDeleteState:  
            break;  
        default:  
            break;  
    }  
}

为什么HWShape存在问题....? 我收到了一个错误:

  

“错误:之前预期的表达式   'HWShape'”。

为什么?非常感谢您的回复。

1 个答案:

答案 0 :(得分:6)

将定义括在括号中:

case HWDrawState:
{
  HWShape *shape = [[HWShapeManager sharedInstance] addShapeWithType:_shapeClass];
}
break;
case ...