gpt4 book ai didi

ios - prepareForSegue 不使用导航 Controller

转载 作者:行者123 更新时间:2023-11-28 08:23:24 25 4
gpt4 key购买 nike

我有一个带有事件指示器的 View Controller ,用于从我的数据库中获取数据。获取所有数据后,此 View 将执行 SegueWithIdentifier 并使用 prepareForSegue 将数据传递给 TableViewController。我遇到的问题是,如果我在获取数据的 View 和获取数据的 TableViewController prepareForSegue 不起作用之间添加导航 Controller ,我就看不到 TableViewController 上的数据。但是,如果我删除导航 Controller ,我就能很好地获取数据。下面是我的 prepareForSegue 方法。我在那里嵌入了一个导航 Controller ,以便通过这个 segue 获得我想要的过渡效果,它应该让 TableViewController 通过推送 segue 从左侧滑入。谢谢

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "serviceView" {
if let destination = segue.destinationViewController as? ServiceTableViewController {
destination.firstName = self.firstName
destination.lastName = self.lastName
destination.email = self.email
destination.streetAddress = self.streetAddress
destination.aptOrSuite = self.aptOrSuite
destination.state = self.state
destination.city = self.city
destination.zipcode = self.zipcode
destination.phone = self.phone
}
}
}

最佳答案

将获取数据的 View Controller 嵌入到导航 Controller 而不是 TableView Controller 中,因此两个 View Controller 都在导航 Controller 的 View Controller 堆栈中

关于ios - prepareForSegue 不使用导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40731177/

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