Hey ;) How can I delete old labels? I request the text for the label from from a text file on my server. Every time when a tab is active, the text file refreshes... But now I have hundreds of dublicates from this label?
So I want to delete the label and after refresh show it again?! Is there any solution?
3 Answers
Hi,
You can use remove() function to remove lables from view or window, yoy can also refresh the lable by changing text property value.
Lable.text ='new value';
Or
parent.remove(); //parent can be either window or view ,on which lable are added.
Everytime when you click on the tab, this function will be loaded.
.... window.addEventListener('focus', function(e) { window.remove(window.scrollbar); // delete scrollview named "scrollbar" myDoRefreshFunction("https://mydomain.com/api/getnew.php",window); // This creates a scrollview with content to var = scrollbar and adds this scrollview directly to "window" });How can I now delete the old ScrollView and replace it with the new? It doesn't works with --> window.remove(window.scrollbar); ???
I do it now like this. But now I have another big problem. My ScrollView does not scroll anymore??!
window.addEventListener('focus', function(e) { myDoRefreshFunction("https://meinemeinung.me/API/iOS/requestlast.php",liveFenster); }); window.addEventListener('blur', function(e) { if (window && window.children != undefined) { // Save childrens var removeData = []; for (i = window.children.length; i > 0; i--){ removeData.push(window.children[i - 1]); }; // Remove childrens for (i = 0; i < removeData.length; i++){ window.remove(removeData[i]); } removeData = null; }; });
Your Answer
Think you can help? Login to answer this question!