Search code examples
iostitaniumappcelerator-mobile

onClick Action in Tabbar is not calling in Titanium


Team,

I am working on a project which is on Titanium, I am facing one small issues which i cannot find the solution, The issue is

In Index.xml file i am writing code for Tabbar, Writing the click action the tag but in iOS that method is not calling, Where as in Android it is working fine, Dont know whats wrong, Below is the code i wrote.

<Tab id="tab4" title="Coverage" icon="/images/Coverage_tab_n.png" onClick="displayCoverage"  class="bcPurple_iOS">

          <Window id="win4" title="Coverage" top="20" bottom="20" class="bcPurple_iOS">

          </Window>
</Tab>

The onClick action code i am writing in the index.js file which is deault,Am i doing any wrong.


Solution

  • This is a feature request in Titanium TIMOB-6499 It was requested to be added in Android and was but hasn't been added in iOS yet.

    Work around could be to use onFocus which works but might not be exactly what you want as it runs when the tabgroup opens. To avoid that, you could set a variable to stop it running on the first load I suppose.

    If you're into compiling from source, there is a quick fix from someone in comment thread in the link above which may or may not work.

    The feature request has been open since Dec 2011 and is marked as low priority.