Search code examples
androidiostitaniumtitanium-mobiletitanium-alloy

How do you support different view for different platforms in Titanium


If I am developing an application for iOS and android, is there a possibility in Titanium alloy mvc framework to maintain 2 different views for the same controller for the 2 different platforms (iOS and android)?


Solution

  • Yep it is possible to have different views for iOS and Android platform. You have to just create nested directory(namely android, ios or mobileweb) under views directory.

    Example to structure directories followed:

    --app
       |
       --views
       |   |
       |   --ios
       |   |  |
       |   |  --index.xml     //ios related xml
       |   --android
       |      |
       |      --index.xml     //android related xml
       --controllers
       |   |
       |   --index.js     //common controller for index.xml
       --styles
           |
           --index.tss     //common style for index.xml
    

    More info in Titanium Docs