ios - 顶部栏显示过渡到根视图控制器 Swift
问题描述
我有一个快速的应用程序,
在我的应用程序中,我想在登录或注销后重新启动应用程序(或转换到根视图控制器)。
我使用该代码重新启动我的应用程序
func restartApplication () {
let initialViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "TabBarVC")
let navCtrl = UINavigationController(rootViewController: initialViewController)
guard
let window = UIApplication.shared.keyWindow,
let rootViewController = window.rootViewController
else {
return
}
navCtrl.view.frame = rootViewController.view.frame
rootViewController.modalPresentationStyle = .fullScreen //or .overFullScreen for transparency
window.isHidden = false
UIView.transition( with: window, duration: 0.3, options: .beginFromCurrentState, animations: {
window.rootViewController = navCtrl
})
}
解决方案
添加
navCtrl.isNavigationBarHidden = true
推荐阅读
- mongodb - mongodb $lookup 与 findOne 模式
- python - 循环创建多个 Pandas 数据框
- javascript - 如何在 Typescript 中引用对象中的嵌套字段
- xcode - Xcode 签名证书无效问题
- node.js - 为什么铬不会在无头模式下打开?
- fortran - 需要找到值何时== 0,但由于数字错误我不能
- python - 向 discord.py 音乐机器人添加队列命令
- c# - C# 从 XslCompiledTransform.Transform 的 XML 中删除不支持 UTF-8 的值
- android - React-Native 项目未在 Expo go 应用程序中打开
- aws-sdk-js - RedshiftDataClient BatchExecuteStatement 将所有查询合二为一