Search code examples
iosobjective-cautoscrollicarousel

iCorousel auto scrolling example does not work with icorousal type linear


Any idea how we can make it work. I have not changed the working code but tried replacing the type:

- (void)viewDidLoad
{
    [super viewDidLoad];

    //configure carousel
    _carousel.type = iCarouselTypeLinear;

    //start scrolling
    [self startScrolling];
}

Solution

  • Yes It's not working for me too and in the iCarouselExampleViewController.m, Issue is with

        [self startScrolling];
    

    when [self startScrolling]; is commented out,leaving out auto scroll, at the least carousel works.

    Working on it. Once i solve will update the post. Just add case iCarouselOptionWrap: return Yes; as mentioned below. It would solve the problem.

        - (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
        {
            switch (option)
            {
                case iCarouselOptionSpacing:
                    return value * 1.1;
                case iCarouselOptionWrap:
                    return Yes;
                default:
                    return value;
            }
        }
    

    Slightly tweaking is needed to

        - (void)scrollStep
    

    to make it work without enabling wrap per se adding condition to check the current item and reload the scroll.