OGeek|极客世界-中国程序员成长平台

标题: ios - 按下时 Segue 不会显示 ViewController [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:55
标题: ios - 按下时 Segue 不会显示 ViewController

我目前在 UITable View 中有一个带有 原型(prototype)单元ViewControllercells 当前在加载时显示来自 Firebase DB 的内容。我想做的是,当按下 cell 时,Firebase DB 会显示更多信息。但是,我目前无法让 seguecellpushViewController。我应该怎么做才能奏效?

我的 Storyboard图片--

enter image description here



Best Answer-推荐答案


这两段代码会有所帮助。快速:

@IBAction func showEntries(_ sender: Any) {
    self.performSegue(withIdentifier: <sequeId>, sender: nil)
}

还有一个包含此操作的按钮。

对于 Objective C,您可以像这样执行 segue。

[self performSegueWithIdentifier"showEditor" sender:self];

通过CTRL创建 Action 并将按钮或单元格拖到相应的代码文件中,选择 Action 并命名。 enter image description here

关于ios - 按下时 Segue 不会显示 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42171618/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4