0
这是我正在尝试做的事情。从CollectionViewCell调用NavigationController(以推送另一个视图控制器)
class UserProfileHeader: UICollectionViewCell {
lazy var button: UIButton = {
let button = UIButton(type: .system)
//...
button.addTarget(self, action: #selector(handleButtonTapped), for: touchUpInside)
return button
}()
func handleButtonTapped() {
print("action working now")
// How to push another vc here?
}
// ...
}
我想调用一个navigationController来在collectionViewCell中推送(显示)另一个ViewController。我怎样才能访问?我试过了,没有工作。是否因为MVC模式?细胞不能与其他人交谈?或者有什么办法可以做到吗?像使用委托/协议?我对这些事情不太了解。
不知道为什么这被拒绝了。 – NRitH
可能是我要求直接从UICollectionViewCell打开storybaord。但最好的办法是,如果可能的话,总是在ViewController中打开 –
我同意。在故事板中连接一个动作会更容易。 – NRitH