How do you delete itemrenderers in a spark Listform for mobile?

牧云@^-^@ 提交于 2019-12-12 04:43:24

问题


I've got a spark ListForm with a custom mxml itemRenderer, all the itemRenderer has is:

<s:Label text="{data.name}" />

When I run the profiler, the listform is not re-using the itemRenderers, the instances keep going up and up, I'm using an arrayCollection as the dataprovider. I even call the dataprovider (arrayCollection) .removeAll() and the display goes blank, yet the number of instances of the itemRenderer does not go down. I then run the garbage collector in the profiler, and the item renderers still stay in memory. How can I remove the itemRenderers from memory?


回答1:


if you just want a label as an item renderer then in mobile applications it's recommended to use the LabelItemRenderer




回答2:


Set the itemRenderer to null. When GC next runs, the item renderers in memory will be removed.



来源:https://stackoverflow.com/questions/7643926/how-do-you-delete-itemrenderers-in-a-spark-listform-for-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!