【发布时间】:2018-03-06 09:43:03
【问题描述】:
如何从嵌套在 TableViewCell 中且 TableViewCell 位于 ViewController 中的 CollectionViewCell 中呈现 ViewController?
我尝试过presentViewController 和performSegue,但无法从单元格中调用它们。
详细解释:
我有三个文件。
- ProfileViewController
- PeopleCategoryTableViewCell
- PeopleCategoryCollectionViewCell
当有人点击 CollectionViewCell 中的故事时,我希望他们重定向到另一个 ViewController,即 SinglePostVC()
我尝试过的:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("inside this")
self.window?.rootViewController?.present(SinglePostVC(), animated: true, completion: nil)
print("outside this")
}
【问题讨论】:
标签: ios swift uitableview uicollectionview presentviewcontroller