#ifdef doesn't work. But why?
CGFloat maxScale;
if ( [[UIScreen mainScreen] respondsToSelector: @selector (scale)] == YES )
{
NSLog (@"case1");
#define GLOBAL1
}
else
{
NSLog (@"case2");
#undef GLOBAL1
}
#ifdef GLOBAL1
NSLog (@"first");
maxScale = 1.0 / [[UIScreen mainScreen] scale];
#else
NSLog (@"second");
maxScale = 1.0;
#endif
#undef GLOBAL1
我的日志:case1,第二个。但首先必须是case1。