简体   繁体   中英

ios app refreshing functions only after double click of the home button

I have a toggle switch in my phone gap application. When i turn it on, its function completes perfectly but all other parts of my app don't behave normally. If i double click home to show all the multitasking pages my app suddenly refreshes or kicks back into gear and everything is working again. What should i do? Thanks.

my toggle switch code is as followed, but i don't think the problem resides here, i think it must be with something about refreshing the app's state.

$('#slider').change(function() {
    var myswitch = $(this);
    var show     = myswitch[0].selectedIndex == 1 ? true:false;

    if(show) {
        for (var i = 0; i<uniqueIDarray.length; i++) {
            searchforSwap(i);

        }
    }
    else {
        for (var i = 0; i<uniqueIDarray.length; i++) {
           searchforSwap(i); 

        }   
    }
});

Without seeing more code, my guess is that there is something running in your deviceready function that is causing the app to refresh correctly. Once you locate what is actually refreshing the app correctly you will need to add it to your toggle code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM