Guest User

Untitled

a guest
Jan 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. icons = try! fileManager.contentsOfDirectory(at: assetURL, includingPropertiesForKeys: [URLResourceKey.nameKey, URLResourceKey.isDirectoryKey], options: .skipsHiddenFiles)
  2.  
  3. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  4. let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "iconCell", for: indexPath)
  5. let iconItem = icons[indexPath.row]
  6.  
  7. // Configure the cell
  8. var imageView: UIImageView
  9. let image = UIImage(named: "Images.bundle/(iconItem.lastPathComponent)")?.resizeImage(newWidth: CGFloat(32)).withRenderingMode(.alwaysTemplate)
  10.  
  11. iconNames.append(iconItem.lastPathComponent)
  12.  
  13. imageView = UIImageView(image: image)
  14. imageView.tintColor = .black
  15. imageView.contentMode = .scaleToFill
  16.  
  17. cell.contentView.addSubview(imageView)
  18.  
  19. return cell
  20. }
Add Comment
Please, Sign In to add comment