So, I\'ve got this definition:
typedef enum {
red = 1,
blue = 2,
white = 3
} car_colors;
Then, I\'ve got a variable of type car_col
// ...
typedef enum {
One = 0,
Two,
Three
} GFN;
// ...
#define kGFNPrefix @"GFNEnum_"
// ...
+ (NSString *)gfnToStr:(GFN)gfn {
return [NSString stringWithFormat:@"%@%d", kGFNPrefix, gfn];
}
+ (GFN)gfnFromStr:(NSString *)str {
NSString *gfnStr = [str stringByReplacingOccurrencesOfString:kGFNPrefix withString:@""];
return [gfnStr intValue];
}
// ...
My choice =)