问题
I do not use the storyboard. I write it with code only.
I would like to know how to tap collectionviewcell to make a transition.
Overlap of view of project is as follows.
/*Color of each view
VC (green)
baseTableV (red)
UItableViewCell
↓
HogeUIView (gray)
tableV (blue)
UItableViewCell
↓
orangeView(orange)
baseColle (purple)
Page0Cell (yellow)
↓
tableV (gray)
UItableViewCell //I want to tap this cell to make a transition. But I can not.
*/
I will ask about that can not be transitioned by tapping.
I would like to see. Please. Thanks.
回答1:
You are just missing one instance of the VC. In your OrangeView class add this:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ColleCellId0, for: indexPath) as? Page0Cell
cell?.vc = vc
return cell!
}
However, I wouldn't do it like this. I would prefer to use delegates. Here is and example of how you could it.
https://github.com/galots/test1126-master
I marked all the delegate code that you need to add with // HERE // so you can find them easily. Good luck
来源:https://stackoverflow.com/questions/53457747/tap-on-uicollectionviewcell-does-not-transition