typedef NS_ENUM(NSInteger, iCarouselType){
iCarouselTypeLinear = 0,? ? ? ? ? ? //線性的 ---> [平鋪,不循環(huán)]
iCarouselTypeRotary,? ? ? ? ? ? ? ? //可旋轉(zhuǎn)的 ---> [外環(huán),層疊]
iCarouselTypeInvertedRotary,? ? ? ? //反向旋轉(zhuǎn)式 ---> [內(nèi)環(huán),層疊]
iCarouselTypeCylinder,? ? ? ? ? ? ? //圓柱式 ---> [外環(huán),拼接]
iCarouselTypeInvertedCylinder,? ? ? //反向圓柱式 ---> [內(nèi)環(huán),拼接]
iCarouselTypeWheel,? ? ? ? ? ? ? ? //車輪式 ---> [車輪,扇形,影響比較大]
iCarouselTypeInvertedWheel,? ? ? ? //反向車輪式 ---> [車輪,扇形,影響比較大]
iCarouselTypeCoverFlow,? ? ? ? ? ? //封面流 ---> [翻頁(yè),不循環(huán)]
iCarouselTypeCoverFlow2,? ? ? ? ? ? //封面流樣式2 ---> [翻頁(yè)2,不循環(huán)]
iCarouselTypeTimeMachine,? ? ? ? ? //時(shí)光機(jī) ---> [向上堆疊,不循環(huán)]
iCarouselTypeInvertedTimeMachine,? //反向時(shí)光機(jī) ---> [反堆疊,不循環(huán)]
iCarouselTypeCustom
};
/*
用來變換carousel展示樣式
*/
@property (nonatomic, assign) iCarouselType type;
/*
用來稍稍調(diào)整在多種3dcarousel視圖中 視覺按照透視法縮短效果的,
它應(yīng)該是一個(gè)負(fù)數(shù),小于0且大于-0.01,
這個(gè)范圍之外的值將會(huì)產(chǎn)生非常奇怪的結(jié)果。
默認(rèn)值是-1/500, or -0.005。
*/
@property (nonatomic, assign) CGFloat perspective;
/*
這個(gè)率用于carousel被快速輕擊時(shí)carousel減速率。值越大表示減速越慢。
默認(rèn)值是0.95.值應(yīng)該在 0.0 和 1.0 之間。
0.0表示:設(shè)置為這個(gè)值時(shí),carousel被釋放時(shí)立即停止?jié)L動(dòng)
1.0表示:設(shè)置為這個(gè)值時(shí),carousel繼續(xù)無(wú)限滾動(dòng)而不減速,直到它到達(dá)底部
*/
@property (nonatomic, assign) CGFloat decelerationRate;
/*
這是當(dāng)用戶用手指輕擊carousel時(shí) 滾動(dòng)速度乘數(shù)。默認(rèn)值是1.0.
*/
@property (nonatomic, assign) CGFloat scrollSpeed;
/*
一個(gè)非包裹樣式的carousel在超過底部時(shí)將彈跳的最大距離。
這個(gè)用itemWidth的倍數(shù)來衡量的,
所以1.0這個(gè)值意味著彈跳一整個(gè)item的寬度,
0.5這個(gè)值是一個(gè)item寬度的一半,以此類推。
默認(rèn)值是1.0.
*/
@property (nonatomic, assign) CGFloat bounceDistance;
/*
使能或者禁止用戶滾動(dòng)carousel。
如果這個(gè)值被設(shè)為no,carousel仍然可以以編程方式被滾動(dòng)。
*/
@property (nonatomic, assign, getter = isScrollEnabled) BOOL scrollEnabled;
/*
是否支持翻頁(yè)
*/
@property (nonatomic, assign, getter = isPagingEnabled) BOOL pagingEnabled;
/*
這個(gè)屬性切換,不管carousel 是水平展示還是垂直展示的。
所有內(nèi)嵌的carousel樣式在這兩個(gè)方向上都可以運(yùn)行。
切換到垂直將會(huì)改變carousel的布局和屏幕上的切換方向。
--***--注意,
自定義的carousel 變換不受這個(gè)屬性影響,但是,切換手勢(shì)的方向還是會(huì)受影響。
*/
@property (nonatomic, assign, getter = isVertical) BOOL vertical;
/*
如果打包被使能的話,返回yes,如果不是返回no。
這個(gè)屬性是只讀的。
如果你想重寫這個(gè)默認(rèn)值,
實(shí)現(xiàn)carousel:valueForOption:withDefault:方法且給iCarouselOptionWrap返回一個(gè)值。
*/
@property (nonatomic, readonly, getter = isWrapEnabled) BOOL wrapEnabled;
/*
設(shè)置carousel在超出底部和返回時(shí)是否應(yīng)該彈跳,或者是停止并掛掉。
--***--注意,
在carousel樣式設(shè)置為纏繞樣式時(shí)或者carouselShouldWrap代理方法返回為yes時(shí),這個(gè)屬性不起作用。
*/
@property (nonatomic, assign) BOOL bounces;
/*
這是以itemWidth的整數(shù)倍來計(jì)算的carousel當(dāng)前的滾動(dòng)偏移量,
這個(gè)值,被截取為最接近的整數(shù),是currentItemIndex值。
當(dāng)carousel運(yùn)動(dòng)中,你可以使用這個(gè)值定位其他屏幕的元素。
這個(gè)值也可以被編程方式設(shè)置如果你想滾動(dòng)carousel到一個(gè)特定的偏移。
如果你想禁用內(nèi)置手勢(shì)處理并提供自己的實(shí)現(xiàn)時(shí),這個(gè)可能有用。
*/
@property (nonatomic, assign) CGFloat scrollOffset;
/*
這是當(dāng)用戶用手指拖動(dòng)carousel時(shí)偏移量的乘數(shù)。
它并不影響編程的滾動(dòng)和減速的速度。
對(duì)大多數(shù)carousel樣式這個(gè)默認(rèn)值是1.0,
但是對(duì)CoverFlow-style樣式的carousels默認(rèn)值是2.0,
來彌補(bǔ)他們的items在空間上更緊湊,
所以必須拖拽更遠(yuǎn)來移動(dòng)相同的距離的事實(shí)。
你不能直接設(shè)置這個(gè)值,
但是可以通過實(shí)現(xiàn)carouselOffsetMultiplier:代理方法來重寫默認(rèn)值。
這個(gè)應(yīng)該是滑動(dòng)一下移動(dòng)的距離。
*/
@property (nonatomic, readonly) CGFloat offsetMultiplier;
/*
這個(gè)屬性用來調(diào)整carousel item views相對(duì)于carousel中心的邊距。
它的默認(rèn)值是CGSizeZero,意思是carousel items是居中的。
改變這個(gè)屬性的值來移動(dòng)carousel items而不必改變他們的視覺。
消失點(diǎn)隨著carousel items移動(dòng),
所以,如果你把carousel items移動(dòng)到下邊,
如果你在carousel上向下看時(shí)他就不會(huì)出現(xiàn)。
*/
@property (nonatomic, assign) CGSize contentOffset;
/*
這個(gè)屬性用來調(diào)整相對(duì)于carousel items的 用戶視點(diǎn),
它有一個(gè)副作用就是調(diào)整contentOffset。
如果你向上移動(dòng)視點(diǎn),然后carousel 顯示是向下移動(dòng)。
與 contentOffset不同,移動(dòng)視點(diǎn)也會(huì)改變和carousel items有關(guān)的視角消失點(diǎn),
所以如果你向上移動(dòng)視點(diǎn),他就會(huì)像你在carousel上向下看一樣出現(xiàn)。
*/
@property (nonatomic, assign) CGSize viewpointOffset;
/*
carousel中 items的數(shù)量(只讀),要設(shè)置他的話,實(shí)現(xiàn) numberOfItemsInCarousel:這個(gè)數(shù)據(jù)源方法。
--***--注意,
所有這些item views在一個(gè)給定的時(shí)間點(diǎn)將會(huì)被加載或者可見
-carousel當(dāng)它滾動(dòng)的時(shí)候經(jīng)要求加載item views。
*/
@property (nonatomic, readonly) NSInteger numberOfItems;
/*
在carousel中展示的占位視圖的數(shù)量(只讀)。
要設(shè)置他,實(shí)現(xiàn)一下numberOfPlaceholdersInCarousel:這個(gè)數(shù)據(jù)源方法。
*/
@property (nonatomic, readonly) NSInteger numberOfPlaceholders;
/*
當(dāng)前carousel中居中的item 的索引,
設(shè)置這個(gè)屬性相當(dāng)于調(diào)用scrollToItemAtIndex:animated:方法時(shí)將 animated參數(shù)設(shè)置為no。
*/
@property (nonatomic, assign) NSInteger currentItemIndex;
/*
當(dāng)前carousel中居中的item view。
這個(gè)視圖的索引與currentItemIndex匹配。
*/
@property (nonatomic, strong, readonly) UIView *currentItemView;
/*
一個(gè)包含了所有當(dāng)前加載的和在carousel中可見的item views的索引,
包括占位視圖的數(shù)組,這個(gè)數(shù)組包含NSNumber的對(duì)象,他們的整數(shù)值與視圖的索引匹配。
這些item views的索引從0開始且與加載視圖時(shí)數(shù)據(jù)源傳遞的索引匹配,
然而,任何占位視圖的索引將是負(fù)數(shù)或者大于等于numberOfItems。
數(shù)組中的placeholder views 的索引并不等于數(shù)據(jù)源中使用的占位視圖的索引。
*/
@property (nonatomic, strong, readonly) NSArray *indexesForVisibleItems;
/*
同時(shí)顯示在屏幕上的carousel itemviews的最大數(shù)量(只讀)。
這個(gè)屬性對(duì)執(zhí)行最優(yōu)化很重要,且是基于carousel的樣式和視圖的frame被自動(dòng)計(jì)算的。
如果你想重寫這個(gè)默認(rèn)值,
實(shí)現(xiàn)一下 carousel:valueForOption:withDefault:
這個(gè)代理方法且給iCarouselOptionVisibleItems返回一個(gè)值。
*/
@property (nonatomic, readonly) NSInteger numberOfVisibleItems;
/*
一個(gè)存放當(dāng)前carousel中展示的所有item views的 數(shù)組(只讀),
它包括任何可見的占位視圖。
這個(gè)數(shù)組中視圖的索引并不與item的索引匹配,
然而,這些視圖的順序與visibleItemIndexes數(shù)組屬性中的順序匹配,
你可以通過從visibleItemIndexes 數(shù)組中去掉對(duì)應(yīng)的對(duì)象來在這個(gè)數(shù)組中獲取一個(gè)指定視圖的索引
(或者,你可以僅僅用indexOfItemView:方法,這個(gè)會(huì)更簡(jiǎn)單)
*/
@property (nonatomic, strong, readonly) NSArray *visibleItemViews;
/*
carousel中展示的items的寬度(只讀)。
這是自動(dòng)從使用carousel:viewForItemAtIndex:reusingView:數(shù)據(jù)源方法第一個(gè)傳到carousel中的視圖中繼承來的。
你也可以使用carouselItemWidth:代理方法重寫這個(gè)值,
這個(gè)方法會(huì)改變分配給carousel items的空間(但是不會(huì)對(duì)這些item views重寫設(shè)置大小或規(guī)模)。
*/
@property (nonatomic, readonly) CGFloat itemWidth;
/*
包含carousel item views的視圖。
你可以增加子視圖如果你想用這些carousel items散置這些視圖。
如果你想讓一個(gè)視圖出現(xiàn)在所有carouselitems的前邊或者后邊,
你應(yīng)該直接添加它到iCarousel view本身來替代。
--***--注意,
在contentView中視圖的順序是受當(dāng)app執(zhí)行時(shí)的頻率和未標(biāo)注的變化決定的。
任何添加到contentView中的視圖
應(yīng)該將他們的 userInteractionEnabled屬性設(shè)置為no,
來防止和iCarousel的觸摸時(shí)間處理放生沖突。
*/
@property (nonatomic, strong, readonly) UIView *contentView;
/*
這個(gè)屬性用于iCarouselTypeCoverFlow2的carousel變換。
它是被暴露的以便于你可以使用
carousel:itemTransformForOffset:baseTransform:
代理方法實(shí)現(xiàn)自己的CoverFlow2樣式變量。
*/
@property (nonatomic, readonly) CGFloat toggle;
/*
默認(rèn)情況下,carousel被輕擊時(shí)會(huì)停在一個(gè)準(zhǔn)確的item邊界。
如果你設(shè)置這個(gè)值為no,他會(huì)自然停止
然后-如果scrollToItemBoundary被設(shè)置為yes-滾回或者向前滾動(dòng)到最接近的邊界
*/
@property (nonatomic, assign) BOOL stopAtItemBoundary;
/*
默認(rèn)情況下,不管carousel何時(shí)停止移動(dòng),
他會(huì)自動(dòng)滾動(dòng)到最近的item 邊界。
如果你設(shè)置這個(gè)屬性為no,
carousel停止后將不會(huì)滾動(dòng)且不管在哪兒他都會(huì)停下來,
即使他不是正好對(duì)準(zhǔn)當(dāng)前的索引。
有一個(gè)特例,如果打包效果被禁止且bounces被設(shè)置為yes,
然后,不管這個(gè)設(shè)置是什么,carousel會(huì)自動(dòng)滾回第一個(gè)或者最后一個(gè)索引,
如果它停下來時(shí)超出了carousel的底部。
*/
@property (nonatomic, assign) BOOL scrollToItemBoundary;
/*
如果為yes,carousel將會(huì)忽略垂直于carousel方向的切換手勢(shì)。
目前,一個(gè)水平的carousel,垂直切換將不會(huì)被攔截。
這就意味著你可以獲得一個(gè)在carouselitem view里的垂直滾動(dòng)的scrollView切它依然會(huì)正確工作。
默認(rèn)值為yes。
*/
@property (nonatomic, assign) BOOL ignorePerpendicularSwipes;
/*
當(dāng)設(shè)置為yes時(shí),
點(diǎn)擊任何在carousel 中的item而不是那個(gè)匹配currentItemIndex 的視圖,
將會(huì)使平滑動(dòng)畫移動(dòng)到居中位置。
點(diǎn)擊當(dāng)前被選中的item將沒有效果。默認(rèn)值是yes。
*/
@property (nonatomic, assign) BOOL centerItemWhenSelected;
/*
這個(gè)方法作用與scrollByNumberOfItems:方法一樣,
但是允許你滾動(dòng)到一個(gè)微小數(shù)量的items。
如果你想達(dá)到一個(gè)非常準(zhǔn)確的動(dòng)畫效果時(shí)可能有用。
--***--注意,
如果scrollToItemBoundary屬性被設(shè)置為yes,
在你調(diào)用這個(gè)方法后carousel無(wú)論如何會(huì)自動(dòng)滾動(dòng)到最近一個(gè)item索引。
*/
- (void)scrollByOffset:(CGFloat)offset duration:(NSTimeInterval)duration;
/*
這個(gè)方法工作起來和 scrollToItemAtIndex:方法一樣,但是允許你移動(dòng)到一個(gè)微小的偏移。
如果你想達(dá)到一個(gè)非常準(zhǔn)確的動(dòng)畫效果時(shí)這個(gè)可能有用。
--***--注意,
如果scrollToItemBoundary屬性被設(shè)置為yes,
當(dāng)你調(diào)用這個(gè)方法之后carousel會(huì)自動(dòng)滾動(dòng)到最近的item索引。
*/
- (void)scrollToOffset:(CGFloat)offset duration:(NSTimeInterval)duration;
/*
這個(gè)方法允許你使用一個(gè)固定的距離滾動(dòng)carousel,以carousel的item寬度來衡量。
整數(shù)或負(fù)數(shù)可能由itemCount來具體確定,取決于你希望滾動(dòng)的方向。
iCarousel很好的處理了邊界問題,
所以如果你指定了一個(gè)大于carousel中items數(shù)量的值,
滾動(dòng)或者在到達(dá)carousel底部時(shí)被夾緊(如果打包被禁止),或者無(wú)停頓地包裹。
*/
- (void)scrollByNumberOfItems:(NSInteger)itemCount duration:(NSTimeInterval)duration;
/*
這個(gè)方法允許你來控制carousel使用 多長(zhǎng)時(shí)間來滾動(dòng)到特定的索引。
*/
- (void)scrollToItemAtIndex:(NSInteger)index duration:(NSTimeInterval)duration;
/*
這個(gè)方法會(huì)使carousel居中在一個(gè)特定的item,
立即或者使用一個(gè)平滑的動(dòng)畫。
對(duì)于打包的carousels,
carousel將會(huì)自動(dòng)決定滾動(dòng)的最短(直線會(huì)或者包著的)距離。
如果你需要控制這個(gè)滾動(dòng)的方向,
或者想滾動(dòng)多于一個(gè)分辨率,使用scrollByNumberOfItems這個(gè)方法。
*/
- (void)scrollToItemAtIndex:(NSInteger)index animated:(BOOL)animated;
/*
返回帶有指定索引的可見的item視圖。
--***---注意,
這個(gè)索引和carousel的位置有關(guān),
且不是在visibleItemViews數(shù)組中的位置,這可能是不一樣的。
傳遞一個(gè)賦值或者一個(gè)大于等于numberOfItems的整數(shù)來取回占位視圖。
這個(gè)方法只有在是可見視圖且情況下才工作,
且如果這個(gè)在指定索引處的視圖還沒被加載時(shí),
或者這個(gè)索引超出范圍時(shí),將返回空。
*/
- (UIView *)itemViewAtIndex:(NSInteger)index;
/*
這個(gè)是carousel中指定item view的索引。
對(duì)item views和placeholder views起作用,
但是,placeholder view索引并不和數(shù)據(jù)源中的索引匹配,且有可能是負(fù)值。
(查看上面indexesForVisibleItems屬性介紹的細(xì)節(jié))。
這個(gè)方法只對(duì)可見的item views起作用且對(duì)目前沒有加載的視圖會(huì)返回NSNotFound。
對(duì)于一列所有加載的視圖,使用visibleItemViews屬性。
*/
- (NSInteger)indexOfItemView:(UIView *)view;
/*
這個(gè)方法給你或者是傳遞的視圖或者是包含有作為參數(shù)的視圖的視圖的item索引。
它通過以傳遞進(jìn)來的視圖為開始,向上遍歷視圖層級(jí),直到找到一個(gè)itemview并返回他在carousel中的索引。
如果沒有找到當(dāng)前加載的item view,它會(huì)返回NSNotFound。
這個(gè)方法對(duì)處理一個(gè)item view內(nèi)嵌的事件控制極其有用。
它允許你綁定你的在控制器中控制單一行為方法的item,且會(huì)找出控制觸發(fā)相關(guān)行為的item。
你可以看一下在Controls Demo example工程中這個(gè)技術(shù)的例子。
*/
- (NSInteger)indexOfItemViewOrSubview:(UIView *)view;
/*
返回以itemWidth整數(shù)倍來記的指定的item索引處的偏移量.
這是用于計(jì)算視圖變換和alpha的相同值,
可以用于根據(jù)carousel的位置自定義項(xiàng)目視圖。
每當(dāng)調(diào)用carouselDidScroll:delegate方法時(shí),這個(gè)值都可以改變。
*/
- (CGFloat)offsetForItemAtIndex:(NSInteger)index;
/* 這會(huì)從carousel移除一個(gè)item,剩下的項(xiàng)目將滑過來填補(bǔ)空位。?
--***--注意, 當(dāng)該方法被指定時(shí),數(shù)據(jù)源不會(huì)自動(dòng)更新, 因此后續(xù)調(diào)用reloadData將恢復(fù)已刪除的項(xiàng)目。 */
- (void)removeItemAtIndex:(NSInteger)index animated:(BOOL)animated;
/* 這將一個(gè)項(xiàng)目插入輪播。? 新的item將從數(shù)據(jù)源中請(qǐng)求, 因此,在調(diào)用此方法之前,請(qǐng)確保已將新項(xiàng)目添加到數(shù)據(jù)源數(shù)據(jù), 否則將在轉(zhuǎn)盤中獲得重復(fù)項(xiàng)目或其他奇怪值。 */
- (void)insertItemAtIndex:(NSInteger)index animated:(BOOL)animated;
/* 此方法將重新加載指定的項(xiàng)目視圖。? 新項(xiàng)目將從數(shù)據(jù)源請(qǐng)求。? 如果 animated 參數(shù)為YES,則會(huì)從舊到新的項(xiàng)目視圖交叉淡化,否則會(huì)立即交換。 */
- (void)reloadItemAtIndex:(NSInteger)index animated:(BOOL)animated;
/* 這個(gè)方法重新從數(shù)據(jù)源加載carousel視圖并刷新carousel的顯示。 */
- (void)reloadData;
/* 返回carousel中界面的數(shù)量 */
- (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel;
/* 返回一個(gè)在carousel中要在指定索引處顯示的視圖, reusingView參數(shù)的作用就像UIPickerView, 之前在carousel中展示過的界面被傳遞到方法中來循環(huán)使用。 如果這個(gè)參數(shù)不是空, 你可以設(shè)置它的屬性并返回它而不是創(chuàng)建一個(gè)新的視圖實(shí)例,這樣可以稍改善性能。 與UITableView不同,這里沒有重用id來區(qū)分不同的carousel界面類型。 所以如果你的carousel包含多個(gè)不同的視圖類型, 那么每次這個(gè)方法被調(diào)用的時(shí)候,你應(yīng)該只是忽略這個(gè)參數(shù)并返回一個(gè)新的視圖。 你應(yīng)該確認(rèn)carousel:viewForItemAtIndex:reusingView:方法每次被調(diào)用時(shí), 它要么返回重用的視圖,要么返回一個(gè)新的視圖實(shí)例而不是保留你自己的循環(huán)視圖池, 因?yàn)椴煌腸arousel界面索引返回多個(gè)相同視圖的復(fù)制品可能造成顯示問題。 */
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view;@optional
/* 返回在carousel中展示的占位視圖。 占位視圖用來當(dāng)carousel中界面太少而不能填滿carousel的寬度, 并且你希望在空白的地方顯示一些東西時(shí)使用。 它們隨著carousel移動(dòng)并且像其他carousel界面一樣運(yùn)行, 但是它們不占numberOfItems數(shù)量,且不能被設(shè)置為當(dāng)前選中的界面。 當(dāng)打包屬性被使能時(shí)占位視圖被隱藏。占位視圖或者顯示在carousel界面的任何一方。 對(duì)于n個(gè)占位視圖,前n/2個(gè)界面將會(huì)出現(xiàn)在界面視圖的左邊,下一個(gè)n/2個(gè)界面會(huì)出現(xiàn)在右邊。 你可以有奇數(shù)個(gè)占位視圖,這種情況下carousel會(huì)是不對(duì)稱的。 */
- (NSInteger)numberOfPlaceholdersInCarousel:(iCarousel *)carousel;
/* 返回一個(gè)視圖作為占位符視圖。? 工作方式與carousel:viewForItemAtIndex:reusingView:相同.? reusingView的占位視圖存儲(chǔ)在單獨(dú)的池中,用于常規(guī)輪播的重用視圖, 因此如果您的占位符視圖與項(xiàng)目視圖不同,則不會(huì)出現(xiàn)問題。 */
- (UIView *)carousel:(iCarousel *)carousel placeholderViewAtIndex:(NSInteger)index reusingView:(UIView *)view;@end@protocol iCarouselDelegate@optional
/*
只要carousel開始動(dòng)畫,就會(huì)調(diào)用此方法。
在用戶滾動(dòng)carousel后,可以編程或自動(dòng)觸發(fā),因?yàn)檩啿ブ匦聦?duì)齊本身。
*/
- (void)carouselWillBeginScrollingAnimation:(iCarousel *)carousel;
/*
當(dāng)carousel結(jié)束動(dòng)畫時(shí),會(huì)調(diào)用此方法
*/
- (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel;
/*
無(wú)論何時(shí)滾動(dòng)都會(huì)調(diào)用此方法。
無(wú)論輪播是以編程方式滾動(dòng)還是通過用戶交互來調(diào)用它。
*/
- (void)carouselDidScroll:(iCarousel *)carousel;
/*
當(dāng)carousel滾動(dòng)導(dǎo)致currentItemIndex屬性更改足夠大時(shí),就會(huì)調(diào)用此方法。
無(wú)論item 的 index 是按程序更新還是通過用戶交互來調(diào)用。
*/
- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel;
/*
當(dāng)用戶開始拖動(dòng)carousel,會(huì)調(diào)用此方法。
如果用戶點(diǎn)擊carousel,或者如果carousel以編程方式滾動(dòng),則不會(huì)觸發(fā)。
*/
- (void)carouselWillBeginDragging:(iCarousel *)carousel;
/*
當(dāng)用戶停止拖動(dòng)輪播時(shí),會(huì)調(diào)用此方法。
willDecelerate參數(shù)指示carousel是否足夠快地行進(jìn),
以便在停止之前需要減速(即當(dāng)前的索引不一定是它將停止的),或者它將停止在哪里。
--***--注意,
即使willDecelerate為NO,輪播仍將自動(dòng)滾動(dòng),直到它完全對(duì)準(zhǔn)當(dāng)前索引。
如果您需要知道何時(shí)完全停止移動(dòng),請(qǐng)使用carouselDidEndScrollingAnimation委托方法。
*/
- (void)carouselDidEndDragging:(iCarousel *)carousel willDecelerate:(BOOL)decelerate;
/*
當(dāng) carousel 開始減速時(shí),會(huì)調(diào)用此方法。
通常會(huì)在 carouselDidEndDragging:willDecelerate:方法之后立即調(diào)用,
如果 willDecelerate為 YES。
*/
- (void)carouselWillBeginDecelerating:(iCarousel *)carousel;
/*
當(dāng)carousel完成減速時(shí),會(huì)調(diào)用此方法,
您可以理解為此時(shí)的currentItemIndex是最終的停止值。
與以前的版本不同,在大多數(shù)情況下,carousel現(xiàn)在將停止在最終的索引位置。
唯一的例外是啟用彈跳的非包裝carousel,
其中,如果最終停止位置超出carousel的終點(diǎn),則carousel將自動(dòng)滾動(dòng),直到其完全對(duì)準(zhǔn)結(jié)束索引。
為了向后兼容,carousel將始終調(diào)用scrollToItemAtIndex:animated:在完成減速后。
如果您需要知道carousel全停止移動(dòng)的時(shí)間,請(qǐng)使用carouselDidEndScrollingAnimation委托方法。
*/
- (void)carouselDidEndDecelerating:(iCarousel *)carousel;
- (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index;
- (void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index;
/*
返回carousel中每個(gè)項(xiàng)目的寬度 - 即每個(gè)項(xiàng)目視圖的間距。
如果方法未實(shí)現(xiàn),
則默認(rèn)為由輪播返回的第一個(gè)項(xiàng)目視圖的寬度:
viewForItemAtIndex:reusingView:的dataSource方法。
如果從carousel返回的視圖:viewForItemAtIndex:reusingView:不正確
(例如,如果視圖的大小不同,或者在其背景圖像中包含影響其影子的陰影或外部輝光,
則此方法僅應(yīng)用于裁剪或填充項(xiàng)目視圖 size)
- 如果你只想放大視圖,那么最好使用iCarouselOptionSpacing值。
*/
- (CGFloat)carouselItemWidth:(iCarousel *)carousel;
/*
此方法可用于為每個(gè)carousel視圖提供自定義變換。
offset是視圖與傳送帶中間的距離。
當(dāng)前中心的item視圖的offset為0.0,右邊的offset為1.0,左側(cè)的offset為-1.0,依此類推。
為了實(shí)現(xiàn)線性輪播樣式,因此,您只需將offset乘以項(xiàng)寬,并將其用作變換的x值即可。
僅當(dāng)輪播類型為iCarouselTypeCustom時(shí),才會(huì)調(diào)用此方法。
*/
- (CATransform3D)carousel:(iCarousel *)carousel itemTransformForOffset:(CGFloat)offset baseTransform:(CATransform3D)transform;
- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value;