Eusthace
Eusthace

Reputation: 3861

iCarousel, how to go/scroll programatically to next item?

I just need to change/scroll or go to next item of the caroussel programatically when the user clicks on a button. I have searched how to do it without success.

Any help?

Thanks.

Upvotes: 0

Views: 994

Answers (2)

coldembrace
coldembrace

Reputation: 550

Swift 4 and the last version of iCarousel pod

carouselView.scrollToItem(at: 1, animated: true)

or

carouselView.scrollToItem(at: 1, duration: 1.0)

Upvotes: 0

Eusthace
Eusthace

Reputation: 3861

I've found the solution, here is the code of my button action:

- (IBAction)onBurning:(id)sender {
    [_carousel scrollByNumberOfItems:1 duration:1.0];
}

Upvotes: 2

Related Questions