ios - 登录后主屏幕中的导航栏未出现

标签 ios iphone swift cocoa-touch

我正在制作一个需要登录的应用程序,所以如果您没有登录,它会重定向到登录屏幕,并且在登录后,它不会完全显示整个“主屏幕”。它缺少导航栏。如果您关闭应用程序并再次打开它,导航栏就在那里。

你们知道为什么吗?任何帮助都将不胜感激。

我正在使用 2 个不同的导航 Controller 。 1 用于登录和注册,另一个用于主屏幕和应用程序的其余部分。

如果我没有登录,我将被重定向到登录屏幕:

override func viewWillAppear(animated: Bool) {
    if (PFUser.currentUser() == nil){
        performSegueWithIdentifier("notSignedIn", sender: self)
    }
}

它会毫无问题地进入登录屏幕。登录后,我尝试了这两种不同的方法,但在重定向到主屏幕后都没有显示导航栏:

方法一

if (user != nil) {
    let homeScreen = self.storyboard!.instantiateViewControllerWithIdentifier("homeScreen") as! TimelineTableViewController

    self.navigationController!.pushViewController(homeScreen, animated: true)
}

方法二 登录后,我重定向回让您登录或注册的屏幕:

self.navigationController?.popViewControllerAnimated(true)

一旦您进入,我将使用相同的围攻返回主屏幕,但无论哪种方式,它都不会在主屏幕中显示导航栏。

最佳答案

你用过吗:

  navigationController?.navigationBarHidden = Bool

如果它没有出现在您的 VC 屏幕中,请使用:

override func viewDidLoad() {
    super.viewDidLoad()

    navigationController?.navigationBarHidden = false
}

关于ios - 登录后主屏幕中的导航栏未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31847773/

相关文章:

ios - iOS 7 中 UITableView 的半透明效果

swift - 飞行模式下的 iOS 13 wifi ssid

ios - UITableViewController 作为下拉列表?

用于 URL Scheme 测试的 iOS 模拟器 WebApp/书签

iOS swift : Displaying asynchronous data on a TableView

ios - iOS应用程序何时直接进入后台状态?

iphone - 如何手动设置 NSManagedObjectID?

iphone - iOS 添加对象到 NSDictionary 并访问 NSDictionary 中的对象

ios - AVAssetWriter startSessionAtSourceTime : Cannot call method when status is 0

ios - 推送后如何将用户带到选定的索引