在 iOS 8 中仅隐藏导航栏而不隐藏状态栏(滑动)

Hide ONLY navigation bar and not status bar (on swipe) in iOS 8

如何像Facebook一样只隐藏导航栏而不隐藏状态栏。使用 navigationController.hidesBarsOnSwipe = true 隐藏两者。 navigationController?.setNavigationBarHidden(true, animated: true)

也是如此

我有一个 table 视图,当 table 滚动时,我希望导航栏隐藏以便为 table

留出更多空间

在应用程序委托中弹出这个 didFinishLaunchingWithOptions 得到了相同的结果。然后我只是在故事板或 viewWillAppear

中将 hidesNavigationBarsOnSwipe 设置为 true
var view: UIView = UIView(frame:CGRectMake(0, 0,self.window!.rootViewController!.view.bounds.width, 20))
view.backgroundColor=UIColor(red: 32/255, green: 159/255, blue: 207/255, alpha: 1)
self.window?.rootViewController?.view.addSubview(view)