Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
small fix regarding scrollToIndexPath (#1642) close #1640
Browse files Browse the repository at this point in the history
  • Loading branch information
IceFloe authored and jessesquires committed Jun 5, 2016
1 parent a430cbe commit 2576960
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,10 @@ - (void)scrollToIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
// if last message is too long, use scroll position bottom for better appearance, else use top
// possibly a UIKit bug, see #480 on GitHub
CGSize cellSize = [self.collectionView.collectionViewLayout sizeForItemAtIndexPath:indexPath];
CGFloat maxHeightForVisibleMessage = CGRectGetHeight(self.collectionView.bounds) - self.collectionView.contentInset.top - CGRectGetHeight(self.inputToolbar.bounds);
CGFloat maxHeightForVisibleMessage = CGRectGetHeight(self.collectionView.bounds) -
self.collectionView.contentInset.top -
self.collectionView.contentInset.bottom -
CGRectGetHeight(self.inputToolbar.bounds);
UICollectionViewScrollPosition scrollPosition = (cellSize.height > maxHeightForVisibleMessage) ? UICollectionViewScrollPositionBottom : UICollectionViewScrollPositionTop;

[self.collectionView scrollToItemAtIndexPath:indexPath
Expand Down

0 comments on commit 2576960

Please sign in to comment.