I'm developing an iPad app using the latest Mobile SDK version 2.1.3.GA, and when building to iPad on the simulator and on the actual device (I haven't tried on iPhone or Android), my Ti.UI.Switch elements always switch back to the "off" position, no matter what their state was when the app comes back to active after being in the background.
For example, I have a layer switching dialog (a Popover) which allows users to turn things on and off. If they make the popover display that holds the switches, then hit the home button to return to the home screen, then come back into the app, you can watch all the switches that were in the "on" position animate to "off". There is no event fired for the switch event either, it just happens silently.
My current "fix" is to keep track of what the value of the switch should be, and then on capturing the "resume" event from the app, ensuring the switch is flipped to the correct state:
Ti.App.addEventListener('resume', function(){ if(obj.isOn != obj.sw.getValue()){ obj.sw.setValue(obj.isOn); } });I'm thinking this must be a bug unless I haven't seen some configuration parameter that would force this kind of behavior. Does anyone else see this? I haven't been able to find any bugs posted on jira about this, and also I can't see how to post a bug for the Mobile project, just some others that aren't relevant.
1 Answer
How does your app load the window? If you have used the switch.value property then it may be set to refresh the screen on reload and reload that value set? Maybe take out the switch.value property and test again?
Your Answer
Think you can help? Login to answer this question!