I have a small issues with macros I have the following macro declared on project-Prefix.pch file
#define IS_IOS7_AND_UP ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)
and I have a macrofile.h which contain the following code, but when I compile I got error "Invalid token at start of a preprocessor expression"
#if (IS_IOS7_AND_UP>0) //error-> "Invalid token at start of a preprocessor expression"
#define CELL_CONTENT_WIDTH 320.0f
#else
#define CELL_CONTENT_WIDTH 300.0f
#endif
Can you please tell me what's wrong about this, actually I need this to be a macro which prevent me of changing many files.
There is no way to do exactly what you are saying. Instead, try defining CELL_CONTENT_WIDTH
like this:
#define CELL_CONTENT_WIDTH (IS_IOS7_AND_UP ? 320.0 : 300.0)
This will do the check at runtime without changing any of your existing code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.