1

I am developing an application based on getting images from backend service and displaying on collection view which have to scroll automatically in horizontal direction.

-(void)scrollAutomatically:(NSIndexPath *)pathRef {

    [_collectionView scrollToItemAtIndexPath:pathRef atScrollPosition:UICollectionViewScrollPositionRight animated:YES];

if (row ==adImgsArr.count-1) {
    _pageControl.currentPage = row;

    row = 0;
}
else
{
    _pageControl.currentPage = row;

    row = row + 1; 
}
pathRef =  [NSIndexPath indexPathForRow:row inSection:section];
[self performSelector:@selector(scrollAutomatically:) withObject:pathRef afterDelay:5.0];

}

I am using the following code, but sometimes its working properly and sometimes it getting crash.

what is modification i need to do here ?

0 Answers0