objective c - How can I conditionally declare a delegate in an interface declaration? -


i have xcode 4 project builds 2 different targets. i've defined constants in build settings can run different code each target this:

#ifdef version1 // #else // #endif 

in 1 version of app, need main view controller open view controller , become delegate, other version doesn't use view controller , shouldn't compile code or try become delegate. i've set main view controller header this:

#ifdef version2 #import "specialviewcontroller.h" #endif  @interface mainviewcontroller : uiviewcontroller <mpmediapickercontrollerdelegate, specialviewcontrollerdelegate> { // etc. 

the conditional around #import tag works fine, how can declare class specialviewcontrollerdelegate in 1 version not other?

just use #define preprocessor directive change delegates between versions. here's example "version2".

#ifdef version2 #import "specialviewcontroller.h" #define args pmediapickercontrollerdelegate, specialviewcontrollerdelegate  #endif  @interface mainviewcontroller : uiviewcontroller <args> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -