gpt4 book ai didi

ios - 在 ViewDidLoad 中执行 Segue

转载 作者:IT王子 更新时间:2023-10-29 05:33:05 25 4
gpt4 key购买 nike

<分区>

如果应用程序是第一次加载,我会尝试执行转场。我可以在调试器中看到我的打印消息,但是 Perform Segue 不工作。我没有收到任何错误。有人可以告诉我怎么了吗?

import UIKit
import LocalAuthentication
let isFirstLaunch = UserDefaults.isFirstLaunch()
extension UserDefaults {
// check for is first launch - only true on first invocation after app install, false on all further invocations
// Note: Store this value in AppDelegate if you have multiple places where you are checking for this flag
static func isFirstLaunch() -> Bool {
let hasBeenLaunchedBeforeFlag = "hasBeenLaunchedBeforeFlag"
let isFirstLaunch = !UserDefaults.standard.bool(forKey: hasBeenLaunchedBeforeFlag)
if (isFirstLaunch) {

UserDefaults.standard.set(true, forKey: hasBeenLaunchedBeforeFlag)
UserDefaults.standard.synchronize()
}
return isFirstLaunch
}
}

class loginVC: UIViewController {





override func viewDidLoad() {

super.viewDidLoad()

if isFirstLaunch == false {
performSegue(withIdentifier: "setPassword", sender: self)
print("testFalse") }
else {
performSegue(withIdentifier: "setPassword", sender: self)
print("testTrue")}


// Do any additional setup after loading the view, typically from a nib.




}

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