Search code examples
appceleratorappcelerator-titaniumappcelerator-alloy

Appcelerator - Different xml for the same controller


Is possible to have one xml for iOS and one xml for Android for the same controller?

For example:

I have que controller: UIPhoto.js

and I want to have 2 different xml and tss files: UIPhoto-iOS.xml and UIPhoto-Android.xml

and charge each when the device is iOS or Android.

Thank you.


Solution

  • Yes it is possible and is quite simple! You just need to have a different folder for the specific platform you want to target. Imagine that you have the index.xml file inside Views folder, right? You can code your xml as you're used to and if you want a different file for Android (let's say), you just need to create a folder inside "Views" folder called Android. Check this image with a folder structure:

    Alloy folder structure

    Notice the Android folder in 'controllers' and the iOS in 'views' ;)