Search code examples
iosswiftswift2icarouseliphone-6-plus

iCarousel is not rendering 3rd view from 4 item on iPhone 6+


So i was trying yo create a simple auto scrolling view with iCarousel.

i made 4 view with image in the centre to be visible, using the

func carousel(carousel: iCarousel, viewForItemAtIndex index: Int, reusingView view: UIView?) -> UIView

and log the index view that are currently rendered,

i test it on ipod touch / iphone 5 / iphone 6, and every view get rendered as the log printed

current index rendered 0
current index rendered 3
current index rendered 2
current index rendered 1

but when i try it on iphone 6+, the log just print :

current index rendered 0
current index rendered 3
current index rendered 1

is it just the carousel? i doubt it.. thats why, what should i do to make the carousel rendered the 3rd view (2)? because on func numberOfItemsInCarousel(carousel: iCarousel) -> Int, i return the count of my image array.

thanks


Solution

  • Sorry, it seems it was the natural behaviour of the carousel of the reused view. when it was on 5 or 6, the dimension of the view allow it to be all rendered when initialized, so the reuse view is not needed. but when it was on 6+, the dimension is larger and it makes the carousel to render just 3 item : the current, the front/right and the back/left (if wrap is enabled, and my setting is enabled)

    then i came to realize that im doing it wrong when reuse the view. what i did before was to get the UI components then recreate their rect. while the example didn't do that.

    so my solution was to not recreate the rect and just change the image attribute of the UIViewImage of the subview