gpt4 book ai didi

IOS 呈现 PageViewController

转载 作者:行者123 更新时间:2023-11-28 15:55:27 29 4
gpt4 key购买 nike

我有一个简单的应用程序,我想在用户首次登录应用程序时在其中显示一个 PageViewController。他们查看教程后,在下一次加载时不会显示 PageViewController。

但是我收到了以下消息。

2017-01-24 00:20:32.620321 Infinity Toolkit[591:83298] Warning: Attempt to present <Infinity_Toolkit.PageViewController: 0x10e026000> on <Infinity_Toolkit.ViewController: 0x10dd0b030> whose view is not in the window hierarchy!    

UIViewController - 默认 Controller

 override func viewWillAppear(_ animated: Bool) {
displayWalkthroughs()
}

显示演练函数

func displayWalkthroughs()
{
// check if walkthroughs have been shown
let userDefaults = UserDefaults.standard
let displayedWalkthrough = userDefaults.bool(forKey: "DisplayedWalkthrough")

// if we haven't shown the walkthroughs, let's show them
if !displayedWalkthrough {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
// instantiate neew PageVC via storyboard
if let pageViewController = storyboard.instantiateViewController(withIdentifier: "PageViewController") as? PageViewController {
self.present(pageViewController, animated: true, completion: nil)
print("tried")

}
}
}

我认为有足够的代码可以在那里进行调查。如果您需要,我们很乐意上传更多内容。

最佳答案

我认为 viewWillAppear 还不够。我认为您只能在调用 viewDidAppear 后显示 UI。尝试将电话拨到那里。

关于IOS 呈现 PageViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41818093/

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