Skip to content

Instantly share code, notes, and snippets.

@KrauserHuang
Created December 17, 2020 03:48
Show Gist options
  • Save KrauserHuang/1078f5fdb936ab3f7dd210e242438102 to your computer and use it in GitHub Desktop.
Save KrauserHuang/1078f5fdb936ab3f7dd210e242438102 to your computer and use it in GitHub Desktop.
@IBSegueAction func showDetail(_ coder: NSCoder) -> UIViewController? {
// guard let item = collectionView.indexPathsForSelectedItems else { return nil }
//利用indexPathsForSelectedItems?.first?.item(row)來對應要顯示的物件
guard let item = collectionView.indexPathsForSelectedItems?.first?.item else { return nil }
let controller = DetailViewController(coder: coder)
controller?.imageName = photos[item]
return controller
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment