diff --git a/iCarousel/iCarousel.h b/iCarousel/iCarousel.h index d49c268203..d716c7db66 100644 --- a/iCarousel/iCarousel.h +++ b/iCarousel/iCarousel.h @@ -113,6 +113,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) CGFloat perspective; @property (nonatomic, assign) CGFloat decelerationRate; @property (nonatomic, assign) CGFloat scrollSpeed; +@property (nonatomic, assign) NSTimeInterval defaultScrollDuration; @property (nonatomic, assign) CGFloat bounceDistance; @property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, assign, getter = isPagingEnabled) BOOL pagingEnabled; diff --git a/iCarousel/iCarousel.m b/iCarousel/iCarousel.m index 48a6f32f74..e6280e1abd 100644 --- a/iCarousel/iCarousel.m +++ b/iCarousel/iCarousel.m @@ -142,6 +142,7 @@ - (void)setUp _contentOffset = CGSizeZero; _viewpointOffset = CGSizeZero; _scrollSpeed = 1.0; + _defaultScrollDuration = SCROLL_DURATION; _bounceDistance = 1.0; _stopAtItemBoundary = YES; _scrollToItemBoundary = YES; @@ -1492,7 +1493,7 @@ - (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)duration - (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated { - [self scrollToItemAtIndex:index duration:animated? SCROLL_DURATION: 0]; + [self scrollToItemAtIndex:index duration:animated? self.defaultScrollDuration: 0]; } - (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated