【问题标题】:iCarousel carouselCurrentItemIndexDidChange method giving wrong indexiCarousel carouselCurrentItemIndexDidChange 方法给出错误的索引
【发布时间】:2017-06-27 11:13:11
【问题描述】:

我正在使用iCarousel 在旋转流中显示图像。 我正在调用这个方法:

-(void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel 

用于在滑动期间更改图像。 现在最初当我来到我的视图控制器时,这个方法被调用,它给了我 -1 当前索引而不是 0(and because of this app crash with beyond bounds for empty array)。 谁能帮帮我!

【问题讨论】:

    标签: ios objective-c nsmutablearray icarousel


    【解决方案1】:

    试试这个

    Swift 3.0

      func carouselCurrentItemIndexDidChange(_ carousel: iCarousel) {
            print(carousel.currentItemIndex)
      }
    

    ObjectiveC

    -(void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel {
           NSLog(@"%d",carousel.currentItemIndex)
    }
    

    【讨论】:

    • 我也做了同样的事情,但我得到了错误的索引。为什么我得到错误的索引,因为我需要帮助
    • 请给我看看你的轮播数据源和委托方法
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多