我正在我的应用程序中实现iCarousel但是当旋转木马停止动画时,无论如何都无法弄清楚哪个视图在前面。感谢任何帮助。
答案 0 :(得分:13)
当iCarousel停止移动时,它会调用以下委托方法:
- (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel;
在该方法中,您可以通过调用
获取最前面视图的索引NSInteger frontmostViewIndex = carousel.currentItemIndex;
如果您需要实际视图本身,只需将其传递给以下方法:
UIView *frontmostView = [carousel itemViewAtIndex:carousel.currentItemIndex];
或者使用此属性,它在内部执行相同的操作:
UIView *frontmostView = carousel.currentItemView;
这有帮助吗?