是否可以使用编译器指令来控制是否实现了特定的委托?
例如,在下面的代码中,如果我们定义了一个常量,我只想包含一个库:
#ifdef kShouldLoadFromCSV
#import "CHCSVParser.h"
#endif
@interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate, CHCSVParserDelegate>{
如果kShouldLoadFromCSV
未定义,我不想实现CHCSVParserDelegate
. 我尝试在接口声明中添加编译指令,但没有奏效。
有没有办法做到这一点?