应用终止后,状态恢复看起来有所不同

时间:2019-07-06 08:44:36

标签: swift state-restoration

在终止后打开应用程序时,都会显示屏幕快照,以快速显示终止前屏幕上的内容。不知道为什么会这样。我的应用程序不使用故事板。

这是我到目前为止尝试做的

AppDelegate.swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    window = UIWindow()
    window?.makeKeyAndVisible()
    window?.rootViewController = BaseTabBarController()
    setupTheme()
    return true
  }

  func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    window?.makeKeyAndVisible()
    return true
  }

  func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool {
    return true
  }

  func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -> Bool {
    return true
  }

Problem

0 个答案:

没有答案