Have you ever noticed the beauty of the navigation bar zooming in Safari mobile clients, and how did the tab bar disappear?
In iOS 8, Apple made this type of interaction very easy, although the zoom navigation bar effect was demonstrated on WWDC, but later they replaced the idea with a hidden navigation, but the tab bar was not included (I guess they later added the properties of the Hidden tab bar).
Here are some of the cool navigation interactions in iOS 8 that allow users to see more content.
Hide Bar when scrolling pages
If you have a table View, just set the Hidesbarsonswipe property of the navigation control to true to OK.
class Quotestableviewcontroller:uitableviewcontroller { override func viewdidappear (animated: Bool) { super.viewdidappear (animated) Navigationcontrollertrue }}
Note that the behavior of the navigation bar affects all the view controls in your navigation stack, so if you want the navigation bar for a view control to not be hidden, you need to set the viewdidappear.
Hide when clicked
If your view is not scrolling as shown above, you can try to set the Hidesbarsontap property to True.
class Quoteimageviewcontroller: Uiviewcontroller { override func Viewdidappear (Animated:bool) {super.viewdidappear (animated) // set Hidesbarsonswift to false // // Navigationcontroller?. Hidesbarsonswipe = false setting Hidesbarsontap to True Navigationcontroller?. Hidesbarsontap = true
Note that if you previously set the Hidesbaronswipe in a view control in the navigation stack, you need to assign it again to false to avoid this view from behaving like other views. Similarly, if there are any settings for table view, then you still need to re-navigationcontroller?. Hidesbarsontap set to False to avoid errors.
Hide when displaying keyboard input
For example, using the new feature of the navigation control Hidesbarswhenkeyboardappears, you can hide the navigation bar when the input keyboard appears:
class Createquotetableviewcontroller: Uitableviewcontroller { override func Viewdidappear (Animated:bool) {super.viewdidappear (animated) Navigationcontroller ?. Hidesbarsonswipe = false This example is just the right combination of Hidesbarsontap and Hidesbarswhenkeyboardappears two features // Span style= "color: #008000;" > so users can easily call back the navigation bar and save the Navigationcontroller?. Hidesbarsontap = true Navigationcontro Ller ?. Hidesbarswhenkeyboardappears = true
To ensure that users can easily call out hidden navigation bars when they are in use, you should set Hidesbarsontap or hidesbarsonswipe to true when needed.
Other features
The following is a demonstration of the other new navigation controller properties, which you can look at:
classUinavigationcontroller:uiviewcontroller {//. .. truncated ///When the keyboard appears, the navigation controller ' s Navigationbar toolbar would be hidden. The bars would remain hidden when the keyboard dismisses, but a tap in the content area would show them.@availability (IOS, introduced=8.0) var hidesbarswhenkeyboardappears:bool///When the user swipes, the navigation controller ' s Navigationbar & toolbar would be hidden (on a swipe up) or shown (on a swipe down). The toolbar only participates if it has items.@availability (IOS, introduced=8.0) var hidesbarsonswipe:bool///The gesture recognizer that triggers if the bars would hide or show due to a swipe. The delegate or attempt to replace this gesture by overriding this method.@availability (IOS, introduced=8.0) var Barhideonswipegesturerecognizer:uipangesturerecognizer {Get } ///When the Uinavigationcontroller's vertical size class is compact, hide the Uinavigationbar and Uitoolbar. Unhandled taps in the regions that would normally is occupied by these bars would reveal the bars.@availability (IOS, introduced=8.0) var hidesbarswhenverticallycompact:bool///When the user taps, the navigation controller ' s Navigationbar & toolbar would be hidden or shown, depending on the Hidden state of the Navigationbar. The toolbar'll is shown if it has items to display.@availability (IOS, introduced=8.0) var hidesbarsontap:bool///The gesture recognizer used to recognize if the bars would hide or show due to a tap in content. The delegate or attempt to replace this gesture by overriding this method.@availability (IOS, introduced=8.0) unowned (unsafe) var Barhideontapgesturerecognizer:uitapgesturerecognizer {Get}
Transferred from: http://www.cocoachina.com/ios/20140923/9729.html
Not to miss the navigation interaction of iOS 8