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

Commit 2576960

Browse files
IceFloejessesquires
authored andcommitted
small fix regarding scrollToIndexPath (#1642) close #1640
1 parent a430cbe commit 2576960

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

JSQMessagesViewController/Controllers/JSQMessagesViewController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ - (void)scrollToIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated
465465
// if last message is too long, use scroll position bottom for better appearance, else use top
466466
// possibly a UIKit bug, see #480 on GitHub
467467
CGSize cellSize = [self.collectionView.collectionViewLayout sizeForItemAtIndexPath:indexPath];
468-
CGFloat maxHeightForVisibleMessage = CGRectGetHeight(self.collectionView.bounds) - self.collectionView.contentInset.top - CGRectGetHeight(self.inputToolbar.bounds);
468+
CGFloat maxHeightForVisibleMessage = CGRectGetHeight(self.collectionView.bounds) -
469+
self.collectionView.contentInset.top -
470+
self.collectionView.contentInset.bottom -
471+
CGRectGetHeight(self.inputToolbar.bounds);
469472
UICollectionViewScrollPosition scrollPosition = (cellSize.height > maxHeightForVisibleMessage) ? UICollectionViewScrollPositionBottom : UICollectionViewScrollPositionTop;
470473

471474
[self.collectionView scrollToItemAtIndexPath:indexPath

0 commit comments

Comments
 (0)