func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "HomePageTitleCell", for: indexPath) as! HomePageTitleCell
cell.news = homePageViewController.sliderList[indexPath.row]
let returnleft = IndexPath(row: 0, section: 0)
self.collectionView.scrollToItem(at: returnleft, at: UICollectionViewScrollPosition.left, animated: true)
return cell
}
How can I use returnleft
after loading UICollectionView
?
let returnleft = IndexPath(row: 0, section: 0)
self.collectionView.scrollToItem(at: returnleft, at: UICollectionViewScrollPosition.left, animated: true)
not working in cellForItemAt