Tap on UICollectionViewCell does not transition

女生的网名这么多〃 提交于 2019-12-25 00:29:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!