gpt4 book ai didi

ios - Segue VS didDeselectRowAtIndexPath

转载 作者:行者123 更新时间:2023-11-29 02:23:06 26 4
gpt4 key购买 nike

我正在使用 didDeselectRowAtIndexPath 浏览不同的 Storyboard,例如:

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let story = ["News","Video","Twitter","Request Info","More"]

let vc = self.storyboard?.instantiateViewControllerWithIdentifier(story[indexPath.row]) as NewsFeedTableViewController
self.presentViewController(vc, animated: true, completion: nil)

}

但是,当我使用此功能时,导航栏 没有显示。但是,当我使用 segue 时,Navigation Bar 出现了。

现在的问题是:

    tableView 中的
  1. Cells 不能继续超过 1 个 Storyboard
  2. 需要导航栏在应用程序中滚动(这似乎需要 Segue)

有什么解决办法吗?

最佳答案

您正在使用 presentViewController,这就是您没有获得 NavigationBar 的原因,它以模态方式呈现 View 。而不是像这样的 pushViewController:

self.navigationController?.pushViewController(vc, animated: true)

可能在您的 Storyboard中,segue 类型将是 push,这就是您获得导航栏的原因。

您可能对以下内容感兴趣:

  1. > presentViewController:animated:completion:
  2. > ViewController Programming Guide for iOS

关于ios - Segue VS didDeselectRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27885401/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com