UICollectionView scroll to last item without Animation
ios, objective-c, scroll, uicollectionview
Solution
The problem was actually caused by problematic Autolayout constraints, see my other thread for the solution that helped me in the end: https://stackoverflow.com/a/24033650/2302437
Problem
I have a UICollectionView to display chat messages. At the beginning I load the existing messages to the collectionView and scroll the collectionView down to the last message with this method: ``` - (void)scrollToLastMessageAnimated:(BOOL)animated; { if (_messages.count == 0) { return; } NSUInteger indexOfLastSection = _messagesBySections.count - 1; NSInteger indexOfMessageInLastSection = [_messagesBySections[indexOfLastSection] count] - 1; NSIndexPath *path = [NSIndexPath indexPathForItem:indexOfMessageInLastSection inSection:indexOfLastSection]; [_collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionCenteredVertically animated:animated]; } ``` This only works animated when I call it in the viewDidAppear: method and not in viewWillAppear: method. How can I scroll down without animation?