The following listing is used in several places in the BMI tool:
typedef NS_ENUM (NSInteger, BMIStatus) { Malnutrition = 1, Anorexia = 2, Thinness = 3, Normal = 4, Overweight = 5, Obesity = 6, Morbid = 7 };
Is there a trick to using "Malnutrition" as a string? Given that I have an image called "Malnutrition.png" that I want to load using the classic ImageNamed, and without using an intermediate array storing [1] => @"Malnutrition" , for example.
My idea would be to use a kind of [UIImage imageNamed:[NSString stringWithFormat:@"%e", Malnutrition]] , where% e leads to an enumeration identifier instead of an associated value.
Thanks.
source share