2017-07-31 79 views
0

我使用JSQMessagesViewController我聊天應用JSQMessage氣泡會向下滾動。iOS的 - 當鍵盤模式切換

當我改變鍵盤輸入模式(即鍵盤語言),氣泡將由高度向下滾動並通過inputToolbar覆蓋。

我發現這個問題也出現在JSQMessagesViewController斯威夫特示例應用程序。所以這可能是一個錯誤。

我試圖使氣泡滾動至底部時,鍵盤輸入模式的變化,但沒有奏效。所以我想這是因爲collectionView's底部是inputToolbar下方。

任何人都可以幫助在這個問題上?謝謝。

ScreenShots

變更前: Before change keyboard mode

變更後: After change keyboard mode

回答

0

使用的CollectionView的方法scrollToItem

像 -

let itemIndex = <Your Desired Index> or array.count - 1 (for scroll down one cell) 
let indexPath = IndexPath(row: itemIndex, section: sectionIndex) 
collectionView.scrollToItem(at:indexPath,at:UICollectionViewScrollPosition.CenteredVertically, animated: true) 

我希望這會起作用! :)