nicklockwood / iCarousel

A simple, highly customisable, data-driven 3D carousel for iOS and Mac OS
http://www.charcoaldesign.co.uk/source/cocoa#icarousel
Other
12k stars 2.58k forks source link

Nested Carousel Error #860

Closed Raviron closed 6 years ago

Raviron commented 6 years ago

Hello, I'm having problems with the nested carousel example. It looks like it runs properly but the data from the first carousel gets copied to the rest. When I changed the data generator to the following:

Specifically I noticed that setting iCarousel.tag seems to have no effect. Is this a bug or am I missing something? Thanks

Raviron commented 6 years ago

Finally figured it out. The example sets the iCarousel.tag value AFTER it is needed. Setting the dataSource value on a carousel triggers the nested calls to numberOfItemsInCarousel and viewForItemAtIndex. So all you have to do is assign the tag immediately after creating the nested carousel, as follows:

Hope this helps, and thanks Nick Lockwood for the carousels. cheers