gpt4 book ai didi

ios - 界面 Controller 标题在运行时不改变

转载 作者:行者123 更新时间:2023-11-29 10:29:48 25 4
gpt4 key购买 nike

我试图在应用程序生命周期的某一时刻以编程方式更改我的Interface Controller 的标题。

但是,当应用程序运行时,这似乎不起作用..?这是故意的、错误还是我做错了什么?

解释:

我设置它的方式是在 Storyboard 中使用标题 aa。然后在 awakeWithContext: 中,我在 User Defaults 中检查一个变量,它决定了为什么状态设置 Interface Controller。在一种情况下,我将标题更改为 yy,在另一种情况下,我通过调用两种设置方法之一将其更改为 xx (setUpForShowing/setUpForCreating)。

在某个时刻,用户将按下一个按钮,该按钮将显示一个模态视图。就在显​​示该 View 之前,我调用了相反的设置方法,更改了 Interface Controller 的状态。屏幕上的所有内容都已正确更改,因此我知道调用了正确的方法。但是,标题不会更新

有人遇到过类似的事情吗?

最佳答案

documentation状态:

An interface controller can make changes to its interface only during initialization and when the interface is active. Once the didDeactivate method is called, any attempts to change the value of related interface objects are ignored until the interface controller’s willActivate method is called again.

尝试使用 setTitle: 方法在 willActivate 中设置标题。

关于ios - 界面 Controller 标题在运行时不改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30292421/

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