gpt4 book ai didi

iphone - segue.destinationViewController 究竟做了什么?

转载 作者:行者123 更新时间:2023-11-28 19:16:35 26 4
gpt4 key购买 nike

嘿伙计们,这行代码是做什么的?

        AddRoleTVC *addRoleTVC = segue.destinationViewController;

我知道第一部分,AddRoleTVC *addRolveTVC,但我不知道 segue.destinationViewController 部分的作用,我找到了许多不同的答案只是不确定哪个是正确的。提前致谢!

最佳答案

这里的 segue.destinationViewController 指向我们要导航到的 ViewController,它的类型是“id”。

因为我们知道我们要导航到哪里,即在本例中是 AddRoleTVC ,所以我们可以将 segue.destinationViewController 当作我们的 AddRoleTVC并对其调用方法。

这就是我们通过 segue 将数据从一个 VC 传递到另一个 VC 的方式,方法是直接在我们的新 ViewController 上调用设置属性方法,即 addRoleTVC

关于iphone - segue.destinationViewController 究竟做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11680992/

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