【发布时间】:2015-03-19 20:12:08
【问题描述】:
public class CommandType {
public static final int DELETE = -1;
}
//Class B - Access from class B here
CommandType.DELETE
如果我正在使用
//ClassA.h
extern int const kMyConstant;
//ClassA.m
int const kMyConstant = @"my constant";
switch (messagetype) {
case kMyConstant: //Can't set const value here
}
我需要将其转换为objectiveC。有可能吗?
【问题讨论】:
-
在 switch 语句中你不能使用 NSString。在 switch 中你应该使用 int 或 char。为此,您可以使用 ENUM
-
哦,我讨厌没有 cmets 的投票! :(如果你这么聪明,为什么不回答这个问题??-
-
@SampathKumar ??我回答你的问题...
标签: ios objective-c public