用户注销并重新登录时不显示徽标

时间:2018-07-25 00:49:03

标签: ios swift

我的App Delegate文件中具有此功能,该文件可创建UINavigationBar。

但是,如果用户是首次启动该应用程序,则当用户注销并重新登录时,徽标不会显示。

这是导航按钮的创建:

private func configureNavigationController(_ navigationController: UINavigationController) {
    navigationController.navigationBar.isTranslucent = false

    self.window?.rootViewController = navigationController

    let imageView = UIImageView(image: UIImage(named: "logo-white"))
    imageView.contentMode = UIViewContentMode.scaleAspectFit

    let center = (navigationController.topViewController?.view.frame.width)! / 2.0 - 44

    let titleView = UIView(frame: CGRect(x: center, y: 0, width: 88, height: 44))
    imageView.frame = titleView.bounds
    titleView.addSubview(imageView)


    UINavigationBar.appearance().barTintColor = UIColor.navBackground
     UINavigationBar.appearance().tintColor = UIColor.white
    UINavigationBar.appearance().addSubview(titleView)
}

在这里创建它:

    guard userHasViewedIntroScreen == true else {
        print("DEBUG gets to intro screen")
        defaults.userHasViewedIntroScreen = true

        if defaults.userHasViewedIntroScreen {
            print("Verfied it is set")
        }

        let navigationController = UINavigationController(rootViewController:  IntroViewController())
        configureNavigationController(navigationController)

        return true;
    }

    let navigationController = UINavigationController(rootViewController:  LogInViewController())
    configureNavigationController(navigationController)

如您所见,无论用户是否是首次使用,它都应该在顶部创建此导航栏。

但是,如果用户注销然后重新登录(在Safari视图控制器中将用户定向到Gmail),则该过程不会再次执行。屏幕顶部的徽标为空白。

仅在用户首次使用该应用程序时(即发生火灾时的介绍条件),这种情况才会发生

介绍条件会导致这种情况发生吗?

0 个答案:

没有答案
相关问题