gpt4 book ai didi

iphone - iOS:标签 View Controller 中的调用方法

转载 作者:行者123 更新时间:2023-12-01 18:19:49 24 4
gpt4 key购买 nike

我试图想出一些简单的东西,但我无法弄清楚。

我有一个 UITabBarController,有一次我必须显示另一个选项卡的 UIViewController,并使用来自原始 UIViewController 的数据在新的 UIViewController 中调用一个方法。

所以基本上我想将数据传递给另一个 UIViewController(可能尚未初始化),并显示正确的选项卡。

如果我使用 NSNotificationCenter ,我不确定选项卡的 UIViewController 是否已经初始化,而且在这里使用委托(delegate)有点难看。

在新选项卡中发送和显示数据的干净方式是什么?

最佳答案

一个更好的主意是在选项卡 View Controller 中实现一个协议(protocol), View Controller 可以调用该协议(protocol)来发送数据并设置任何其他 View Controller

关于iphone - iOS:标签 View Controller 中的调用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18345239/

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