I have about 200+ items on local storage which I am supposed to show in iCarousel.

I know I can update my data model array and call [carousel reloaddata]. But I don't want to include any control just for this. I want to keep this as last choice because this will include some visual flicker in reloading.

I ideally want to do it during scrolling itself. Like:

  • I can keep about 20 items in my datasource array
  • I can fill the carousel with these 20
  • As user scrolls, at some point, I empty the datasource array
  • Empty the carousel and call reloadData to update with newer items
  • User should not be aware that this reloading happened.

In a nutshell, without consuming too much resources I want the carousel scrolling smooth and seamless.

What iCarousel events should I trap and when?

Should I be reusing same item views or remove existing and start afresh with new data?

P.S.

On a side note, does anyone know how many item views carousel can support at a time, with memory considerations? On a single item view, I have 2 UILabels, 1 image (different for each item view) and 1 background image (same for each item view). Can anyone estimate the total possible item views my carousel can support at a given time? If it can be about 100 then I can afford the reload flicker after 100. But I don't want to have it after scrolling just 20.

有帮助吗?

解决方案

There won't be 200 views loaded. As you scroll you will be asked for the view and given the index. If there is a reusable view provided, use it. If not, create a new one. You should tell the carousel about how many views there are (200+, not just 10 and then change). The carousel will manage the memory if you reuse the views properly. You can run a test, log the pointer for each view and see how many uniques there are when you reuse the views. It should be close to the number of views that can be on screen at any one time.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top