iOS学习笔记:“iCarousel” 旋转木马效果

参考Demo:https://github.com/nicklockwood/iCarousel

作者是英国 Charcoal Design 公司的创始人,这是一款可以在 iOS 上实现旋转木马视图切换效果的第三方控件, 并提供多种切换效果。

1.iCarousel支持以下内置显示类型:

iCarouselTypeLinear

iCarouselTypeRotary

iCarouselTypeInvertedRotary

iCarouselTypeCylinder

iCarouselTypeInvertedCylinder

iCarouselTypeWheel

iCarouselTypeInvertedWheel

iCarouselTypeCoverFlow

iCarouselTypeCoverflow2

iCarouselTypeTimeMachine

iCarouselTypeInvertedTimeMachine

自定义类型:iCarouselTypeCustom

2.使用方法:

将view的类设为iCarousel,使用iCarousel的协议,然后设置delegate和dataSource。

- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel,设置显示在iCarousel上的元素的个数;

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view;设置在iCarousel上显示的内容

- (void)carouselDidEndScrollingAnimation:(iCarousel *),可以获得icarousel上停止滑动时当前的元素,因为iCarousel有一个属性是currentItemIndex;

- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value,可以设置iCarousel的一些属性,比如说可以设置可滑动显示的内容可以循环显示,还可以设置每个元素的高度,每次显示多少个元素等等。

3.参考资料:如何轻松实现iOS9多任务管理器效果(iCarousel高级教程) - CocoaChina_让移动开发更简单

你可能感兴趣的:(iOS学习笔记:“iCarousel” 旋转木马效果)