条件によっては文字列になるマクロを作ろうとしています。目標は、アプリが実行されているデバイスの種類 (iPhone、iPhone Retina、iPad、または iPad Retina) を検出することです。
これが私の試みです:
#define BEST_PICTURE_SIZE_KEY \
if([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale]==2.0) \
(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)?@"LARGE":@"HUGE" \
else \
(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)?@"BIG":@"LARGE"
しかし、私がそれを使用しようとすると、エラーが発生します:
if([lc_classified.photo objectForKey:BEST_PICTURE_SIZE_KEY])
[lc_urlArray addObject:[NSString stringWithFormat:@"%@%@",appdelegate.initObject.imgPrefix,[lc_classified.photo objectForKey:BEST_PICTURE_SIZE_KEY]]];
何か案が ?ありがとう