Xcode Swift ViewDidLoad [英] Xcode Swift ViewDidLoad
问题描述
我有两个 ViewController.当我按下 FirstViewController 上的按钮时,SecondViewController 就会出现.当我按下 SecondViewController 上的按钮时,FirstViewController 再次出现.问题是,FirstViewController 上的视图不会再次加载.ViewDidLoad 循环不会再次加载.我想创建一个循环,它会在每次 FirstViewController 出现时检查一个变量.
I have two ViewControllers. When I press a button on the FirstViewController the SecondViewController shows up. When I press a button on the SecondViewController the FirstViewController shows up again. The problem is, that the View on the FirstViewController does not load again. The ViewDidLoad loop does not load again. I want to create a loop, which checks a variable every single time the FirstViewController shows up.
推荐答案
将该代码放入 viewDidAppear
或 viewWillAppear
.
Put that code in viewDidAppear
or viewWillAppear
.
这篇关于Xcode Swift ViewDidLoad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!