Sunday 15 April 2012

objective c - Preprocessor macro check when defining a class's interface declaration -



objective c - Preprocessor macro check when defining a class's interface declaration -

i have nswindowcontroller has window subclass in xib. until 10.10 had window subclass (we phone call windowsubclassb) subclass of nswindow , did fancy ui stuff

now yosemite, no longer need subclass window on yosemite, still previous os x versions.

i though of few different options, such setting different .xib yosemite , other version, xib has lot of pieces , mean have maintain 2 different xibs prepare this.

so i've attempted utilize preprocessor macros @ build time determine class subclass

i tried:

#if mac_os_x_version_min_required >= mac_os_x_version_10_10 @interface gfmosxmainwindow : nswindow #else @interface gfmosxmainwindow : inappstorewindow #endif

but code not executed on yosemite because it's not minimum requirement

what accomplish below:

#if current_osx_version == osx_version_10_10 @interface windowsubclassa : nswindow #else @interface windowsubclassa : windowsubclassb #endif

i not, however, see such macro @ build time tell me current version of os x app built on is.

also, if knows how tell uiwindowcontroller programmatically class it's @property window should initialized as, solve whole issue :)

thanks in advance!

the problem trying in that, code not compiled multiple times different scheme versions. if anything, it'd compiled differently different processors (like 32/64 bit on osx, or armv7, armv7s , arm64 on ios). think it's not possible accomplish in way.

i don't have thought alternative solution yet, isn't wild dynamic method setting using objc runtime.

objective-c osx

No comments:

Post a Comment