ios - 从应用程序委托(delegate)呈现导航 Controller 后,状态栏和导航标题和项目会稍后显示

标签 ios swift uinavigationcontroller uinavigationbar

let check = defaults.bool(forKey: "logged_in")
    if(check){
        let storyBoard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyBoard.instantiateViewController(withIdentifier: "homevc") a[enter image description here][1]s! UINavigationController
        self.window?.rootViewController = vc
        self.window?.makeKeyAndVisible()
    }

[这里是当 rootviewcontroller 可见时,几秒钟后,状态栏首先神奇地出现,然后导航栏属性出现。

image description

最佳答案

必须在主线程上进行 UI 更改。确保在主线程上调用 window.makeKeyAndVisible() 函数。喜欢:

DispatchQueue.main.async {
   window.makeKeyAndVisible()
}

关于ios - 从应用程序委托(delegate)呈现导航 Controller 后,状态栏和导航标题和项目会稍后显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46526038/

相关文章:

ios - 在 UITabbarController 中使用 UINavigationController

ios - 将 subview Controller 正确添加到 UINavigationBar

ios - 无法停止设备旋转

iphone - IOS 中是否存在用于 UI 控件自动化的现有库

ios - 在带有消息的远程通知中显示超链接

ios - 是否有与 UIButton 上的 addTarget 不同的选项

ios - 通过 Swift 以编程方式获取 Apple Music 播放列表共享 URL

ios - -[id<UIGestureRecognizerDelegate> gestureRecognizer :shouldRecognizeSimultaneouslyWithGestureRecognizer] both recognizers are nil in debugger

ios - editButtonItem 不起作用

ios - 使自定义 UITableView 单元格正确显示内容(非空白)