contentView.collectionView.delegate = self
contentView.collectionView.dataSource = self
if let layout = contentView.collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
layout.scrollDirection = .horizontal
}
}
private func scrollToCurrentItem() {
guard let indexPath = getCurrentMediaIndexPath(fromMedia: messages, currentMessage: currentMessage) else { return }
contentView.collectionView.layoutIfNeeded()
contentView.collectionView.scrollToItem(at: indexPath, at: .right, animated: false)
contentView.collectionView.isPagingEnabled = true
}
есть тестовый пример?
Обсуждают сегодня