2016-08-06 6 views
0

までスクロールしようとすると奇妙なバグ、collectionViewビューが最後の2番目のメッセージにスクロールします。ただし、最後の2番目のものにスクロールします。コレクションビューの下にスクロールするには、このコードを使用して

private func scrollToBottom() { 
    let lastSectionIndex = (ChatCollectionView?.numberOfSections())! - 1 
    let lastItemIndex = (ChatCollectionView?.numberOfItemsInSection(lastSectionIndex))!-1 
    let indexPath = NSIndexPath(forItem: lastItemIndex, inSection: lastSectionIndex) 

    ChatCollectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.Bottom, animated: false) 
} 

その

+0

私はあなたのコードを使用しますが、私は正しい結果を得ています。 – Catoshi

答えて

0

あなたのコレクションビューの枠が表示領域の下にあったようにバグに精通誰です。目に見える範囲内にその底を設定する必要があります。

関連する問題