Search code examples
iosicarousel

How to bring currentview of iCarousel to the top of other views in iCarouselTypeWheel


I want to create a wheel similar to "http://www.asianpaints.com/royale" in iOS, till now I have used iCarousel type: iCarouselTypeWheel. It almost works for me but main problem is the center view got overlapped by next elements. Please let me know how to fix.

Thanks in advance for any help.


Solution

  • You will actually need to change the z transform value (that is returning) of CATransform3DTranslate function in transformForItemViewWithOffset method. This is kind of hacky though.

    To do this,

    • Open your iCarousel.m file
    • Look for -(CATransform3D)transformForItemViewWithOffset:(CGFloat)offset method
    • Inside the switch case statement, go to iCarouselTypeWheel and in the else part, you will need to change the line

      return CATransform3DTranslate(transform, 0.0f, -radius, offset * 0.01f);
      

      to

      return CATransform3DTranslate(transform, 0.0f, -radius, 0.0f);
      

    Save the file and run the project to see if that gives you the desired result.