考虑typedef_NS_ENUM

时间:2016-08-29 15:15:49

标签: ios objective-c

我想通过typedef NS_ENUM让我的代码更具可读性。我有3个案例。请查看代码:

typedef NS_ENUM(NSInteger, drawCase) {
    drawCaseStart,
    drawCaseIn,
    drawCaseAfter
};


@interface DayGraphViewCircle ()

@property (nonatomic) drawCase *myCase;

然后:

-(void)choseDrawCase{

    switch (self.drawCases) {
        case 0:
            _myCase = drawCaseStart;
            break;

        case 1:
            _myCase = drawCaseInProcess;
            break;

        case 2:
            _myCase = drawCaseAfter;
            break;

        default:
            break;
    }
}

如果1和2编译器使用黄色不兼容integer to pointer conversion assigning to 'drawCase *' (aka 'enum drawCase *') from 'NSInteger' (aka 'long')

突出显示我的代码

我做错了什么?

0 个答案:

没有答案