변수 "indexx"를 만들려고하는데 다음 번 tableController에 이어질 것입니다. indexx는 내 collectionView에서 선택한 셀의 indexPath를 유지하지만 어떤 속성을 사용할 지 확신하지 못합니다. 나는이 코드 조각에 대한 성공적인 솔루션을 찾는 데 어려움을 겪고 있기 때문에 tableController 속성을 훨씬 더 잘 알고 있습니다. 내 실수를 알기라도 해 주시겠습니까?indexPathForSelectedRow의 collectionView 형식은 무엇입니까?
빠른 참고 - foodcv는 내 collectionView이고 numberr은 두 번째 대상 컨트롤러의 변수입니다.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destViewController = segue.destination as? foodtable {
let indexx = self.foodcv.indexPath(for: foodcell)
destViewController.numberr = indexx
}
}
let numberr : IndexPath = []
['collectionView.indexPathsForSelectedItems() '] (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionVie w_class/# // apple_ref/occ/instm/UICollectionView/indexPathsForSelectedItems) – ozgur
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/#//apple_ref/occ/instm/UICollectionView/indexPathsForSelectedItems –
거기에 선택 항목의 인덱스 경로가 있습니까? – jonpeter