Created
December 23, 2015 04:40
-
-
Save yourtion/66d7b49c896d1611bd28 to your computer and use it in GitHub Desktop.
convert NS_ENUM to NSString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef NS_ENUM(NSInteger, JHAlcoholCategory) { | |
JHAlcoholCategoryWhiteSpirit = 1, | |
JHAlcoholCategoryChampagne = 11, | |
JHAlcoholCategoryWine = 12, | |
JHAlcoholCategoryLiquer = 16, | |
JHAlcoholCategoryBeer = 17, | |
JHAlcoholCategoryWineset = 19, | |
JHAlcoholCategoryGift = 18, | |
JHAlcoholCategorySet = 20, | |
JHAlcoholCategoryOneKey = 21, | |
JHAlcoholCategoryNation = 22 | |
}; | |
NSString * const JHAlcoholCategoryDescription[] = { | |
[JHAlcoholCategoryWhiteSpirit] = @"Spirit", | |
[JHAlcoholCategoryChampagne] = @"Champagne", | |
[JHAlcoholCategoryWine] = @"Wine", | |
[JHAlcoholCategoryLiquer] = @"Foreignwine", | |
[JHAlcoholCategoryBeer] = @"Beer", | |
[JHAlcoholCategoryWineset] = @"Wineset", | |
[JHAlcoholCategoryGift] = @"Gift" | |
}; | |
+(NSString *)getAlcoholString:(JHAlcoholCategory)cid { | |
return JHAlcoholCategoryDescription[cid]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment