Dan*_*rde 5 if-statement objective-c c-preprocessor
我已经阅读了#if和#define语句的许多定义.
我尝试使用我读取的方式,但只有错误" 预处理程序表达式启动时出现无效标记 "这一行将其定义为下面的注释:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#define is_ipad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define is_ipad_hd ( (is_ipad == 1 && [UIScreen mainScreen].bounds.size.width > 1024 ) ? YES : NO)
#define is_iphone_hd ([UIScreen mainScreen].bounds.size.width > 480 ? YES : NO)
#define device_width 480.0f
#define device_height 320.0f
#if (is_ipad_hd == YES) // Error here
#define device_width = 2048.0f
#define device_height = 1496.0f
#endif
Run Code Online (Sandbox Code Playgroud)
为什么它适用于简单的教程,当我们尝试更复杂的事情时,这些事情就会发生!