我在我的应用程序中使用 iCarousel,我需要获取 iCarousel 的当前索引并将该索引显示在标签(self.view 的 subview )中,该标签不是 iCarousel 的 subview 。
我能够得到当前的索引
int index=iCarousel.currentIndex;
如何在每次滚动轮播时更新 label.text 中的索引。
在哪种方法中我必须编写代码来更新标签。
最佳答案
每当您滚动时,都会调用以下委托(delegate),因此您可以在此处更新您的标签
- (void)carouselCurrentItemIndexUpdated:(iCarousel *)carousel1
{
int index=carousel1.currentIndex;
yourlabel.text = [NSString stringWithFormat:@"%d",index];
}
关于iphone - 在不是 ICarousel 中的 subview 的标签中显示 iCarousel 的当前索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14768142/