Skip to content

Instantly share code, notes, and snippets.

@KrauserHuang
Last active December 17, 2020 03:39
Show Gist options
  • Save KrauserHuang/6a3b15dbc57367e723a37b96c6950530 to your computer and use it in GitHub Desktop.
Save KrauserHuang/6a3b15dbc57367e723a37b96c6950530 to your computer and use it in GitHub Desktop.
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! PhotoCollectionViewCell
// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PropertyKeys.PhotoCollectionViewCell, for: indexPath) as! PhotoCollectionViewCell
// Configure the cell
//直接抓圖庫的圖片
// cell.photoImageView.image = UIImage(named: "photo\(indexPath.item)")
//藉由變數photos利用indexPath判斷要顯示哪個item
cell.photoImageView.image = UIImage(named: "\(photos[indexPath.item])")
return cell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment