简体   繁体   中英

ios8 Hide/Show Navigation Bar and Toolbar

iOS 8.2 - iPad or iPhone.

I'm creating a basic Master-Detail app in Xcode to test the UISplitViewController. I'm selecting my detail-navigation controller from the storyboard and selecting that I want to show the toolbar. This appears in the storyboard.

I'm also selecting Hide Bars on Tap in the properties window (as shown).

在此处输入图片说明

However, when I run the app, only my Navigation bar appears/disappears. The toolbar remains static at the bottom of the screen. Even if I set this in code, my toolbar is still static.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    let splitViewController = self.window!.rootViewController as UISplitViewController
    let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as UINavigationController
    navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
    splitViewController.delegate = self

    navigationController.hidesBarsOnTap = true;
    return true
}

Yet the documentation suggests both bars should be hidden/shown on tap.

Discussion When the value of this property is YES, the navigation controller toggles the hiding and showing of its navigation bar and toolbar in response to an otherwise unhandled tap in the content area. The default value of this property is NO.

Does this property actually work on the toolbar? If so, is there anything else I should be doing? Thanks

仅当您在其中放置了条形按钮项时,工具栏才会隐藏。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM