gpt4 book ai didi

iphone - 在不是 ICarousel 中的 subview 的标签中显示 iCarousel 的当前索引

转载 作者:行者123 更新时间:2023-12-01 17:18:32 24 4
gpt4 key购买 nike

我在我的应用程序中使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com