J'ai utilisé le typedef enum ci-dessous mais le switch retourne toujours le cas par défaut pourquoi ?
typedef enum {
first,
LatestNews,
Opinion,
Special,
Sports,
Thisweek,
} NAChannelTitle;
-(NSString *)getImageName:(NSString *)channelName {
NAChannelTitle temp = (NAChannelTitle)[channelName stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"Temp : %@",temp);
switch (temp) {
case first:
return @"background-channel-sporttitle-portrait.png";
break;
case LatestNews:
return @"background-channel-title-portrait.png";
break;
case Opinion:
return @"background-channel-title-portrait.png";
break;
case Special:
return @"background-channel-sporttitle-portrait.png";
break;
case Sports:
return @"background-channel-sporttitle-portrait.png";
break;
case Thisweek:
default:
return @"background-channel-title-portrait.png";
break;
}
return nil;
}