This helped me - :
@property (nonatomic, assign) CGPoint scrollingPoint, endPoint;
@property (nonatomic, strong) NSTimer *scrollingTimer;
@property (nonatomic, assign) BOOL animationStarted;
//scroll with finite time interval
- (void)scrollSlowlyWithInterval:(NSNumber*)interval {
CGFloat height = self.clViewImages.contentSize.height;
animationStarted = YES;
// Set the point where the scrolling stops.
self.endPoint = CGPointMake(0, height-self.clViewImages.frame.size.height);
// Assuming that you are starting at {0, 0} and scrolling along the x-axis.
self.scrollingPoint = CGPointMake(0, 0);
// Change the timer interval for speed regulation.
self.scrollingTimer = [NSTimer scheduledTimerWithTimeInterval:[interval doubleValue] target:self selector:@selector(scrollSlowlyToPoint) userInfo:nil repeats:YES];
}
- (void)scrollSlowlyToPoint {
[self.clViewImages setContentOffset:self.scrollingPoint animated:YES];
// Here you have to respond to user interactions or else the scrolling will not stop until it reaches the endPoint.
if (CGPointEqualToPoint(self.scrollingPoint, self.endPoint)) {
[self.scrollingTimer invalidate];
animationStarted = NO;
}
// Going one pixel to the right.
CGFloat height = [UIScreen mainScreen].bounds.size.height/2;
self.scrollingPoint = CGPointMake(self.scrollingPoint.x, self.scrollingPoint.y+height);
}
// scrolling to bottom without default animation
-(void)scrollToBottom{
NSInteger section = [self.clViewImages numberOfSections] - 1;
NSInteger items = [self.clViewImages numberOfItemsInSection:section] - 1;
NSIndexPath *indxPath = [NSIndexPath indexPathForItem:items inSection:section];
[self.clViewImages scrollToItemAtIndexPath:indxPath atScrollPosition:UICollectionViewScrollPositionBottom animated:YES];
}
-(void)reloadCollectionView{
dispatch_async(dispatch_get_main_queue(), ^{
[self.clViewImages reloadData];
if(!animationStarted){
[self scrollSlowlyWithInterval:[NSNumber numberWithDouble:0.50f]];
}
});
}
thanks to Chris