我有一个 iCarousel 画廊,我在其中从 Web 服务获取图像。画廊完美展示。我使用 iCarasouel 委托(delegate)方法“didSelectItemAtIndex”来选择第一张到最后一张图像。我的 icarousel 类型是“carousel.type = iCarouselTypeCoverFlow;”。
我选择了图像并获得了正确的图像索引,只有当我滚动图库并且图像从中心移动时,didSelectItemAtIndex 才能正常工作,但是当加载 View 时,显示在中心的“Frist 或任何图像”未被选择didSelectItemAtIndex。当我再次滚动画廊并且中心图像从中心移动时它工作正常,然后我可以选择图像并转到下一个类或 View 。
我想选择显示在 Icaraosel 中心的图像。不知道该怎么做?
非常欢迎来自专家的任何提示。
最佳答案
您可以在下面给定的委托(delegate)方法中获取图像的当前索引
- (void)carouselCurrentItemIndexUpdated:(iCarousel *)carousel1
一旦你的图片完全加载,然后调用
[self carouselCurrentItemIndexUpdated:carousel];
代码如下:
在您的 viewDidLoad 中调用如下所示的方法,这里的 carsousel 是 iCarsouel 的一个实例。
- (void)viewDidLoad
{
[super viewDidLoad];
[self carouselCurrentItemIndexUpdated:carousel];
}
- (void)carouselCurrentItemIndexUpdated:(iCarousel *)carousel1
{
self.currentItem=carousel1.currentItemIndex;
NSLog(@"currentItem update== %i",self.currentItem);
}
希望这对您有所帮助....
关于objective-c - 如何只选择 iCarousel 的中心图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14152715/