【发布时间】:2018-11-24 21:38:32
【问题描述】:
嗨,当我将参数传递给scrollToItemAtIndexPath 时,我遇到了 NSTimer 的问题,它总是被终止。有人可以帮忙吗?
SlideCollectionViewCell *cell = [collectionImageSlideView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
cell.showImage.image = [UIImage imageNamed:[images objectAtIndex:indexPath.row]];
NSInteger rowIndex = indexPath.row;
NSInteger imageCount = self->images.count-1;
if(rowIndex<imageCount){
rowIndex = rowIndex+1;
}else{
rowIndex = 0;
}
scrollingTimer = [NSTimer scheduledTimerWithTimeInterval: 5.0
target: self
selector:@selector(startTimer:)
userInfo: @(rowIndex) repeats:YES];
return cell;
【问题讨论】:
标签: ios objective-c uiscrollview uicollectionview nstimer