我想问一下如何创建一个具有线性无限效果的iCarousel?我的意思是,它是直线型和旋转型的组合。例如,数字1-10以线性方式显示,那么10旁边的数字是1。
这个是可能的吗?谢谢
发布于 2015-01-02 03:17:49
首先,将carousel设置为包装,方法是执行
- (BOOL)carouselShouldWrap:(iCarousel *)carousel {
//wrap all carousels
return YES;
}接下来,您可以使用NSTimer启动滚动。例如:
self.scrollTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(scrollCarousel) userInfo:nil repeats:YES];
- (void)scrollCarousel {
NSInteger newIndex=self.carousel.currentItemIndex++;
if (newIndex > self.carousel.numberOfItems) {
newIndex=0;
}
[self.carousel scrollToItemAtIndex:newIndex duration:5]; // takes 5 seconds to scroll
}https://stackoverflow.com/questions/27528193
复制相似问题