Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MonoDevelop/MonoTouch #if iPHONE?

I'm currently working on a multiplatform app for iPhone and various other devices, as far as I can work out I can use preprocessor directives to check if I'm building for iPhone or another platform, so for example I could have:

#if WINDOWS_PHONE
ScreenRes = new Vector2(800,480);
#endif

#if XBOX360
ScreenRes = new Vector2(1280,720);
#endif

However I'm not sure which declaration I'm supposed to use to check for iPhone, I've already tried IPHONE, IOS, I_PHONE and a few others.

like image 313
meds Avatar asked Apr 17 '11 07:04

meds


2 Answers

We do not define any by default. You can do this by adding the define yourself when you build it with MonoDevelop to your configurations.

like image 123
miguel.de.icaza Avatar answered Oct 20 '22 01:10

miguel.de.icaza


Recent versions of Xamarin Studio will provide extra defines to the compiler.

E.g. for Xamarin.iOS both __MOBILE__ and __IOS__ will be defined.

E.g. for Xamarin.Android both __MOBILE__ and __ANDROID__ will be defined.

like image 43
poupou Avatar answered Oct 20 '22 02:10

poupou