Search code examples
iosobjective-ciphonexcodeicarousel

iCarousel scroll


How to scroll in a specific item or index, for example: I set an NSInteger on another UIView then pass it to my iCarousel. In my other UIView I set the NSInteger like this:

[[NSUserDefaults standardUserDefaults] setInteger:button.tag
                                           forKey:@"integer"];

[[NSUserDefaults standardUserDefaults] synchronize];

When scrolling I use this :

[carousel scrollByNumberOfItems:-35 duration:10.7550f];

how to pass the integer to the carousel, to make it scroll then stop it to that specific item or index.


Solution

  • - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated;`
    

    Clearly stated and described in the README. First method under methods

    Or, if you prefer:

    - (void)scrollToItemAtIndex:(NSInteger)index 
                       duration:(NSTimeInterval)scrollDuration;`