Not to miss the navigation interaction of iOS 8

Source: Internet
Author: User

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.VI Ewdidappear (animated) Navigationcontroller? Hidesbarsonswipe = True}}

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         //  it will not have any effect after this condition         //   But in the last VC it was set to True        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          //  so users can easily call back the navigation bar and save          Navigationcontroller?. hidesbarsontap = true                  navigationcontroller?. 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:

class uinavigationcontroller : uiviewcontroller {     //...  truncated         /// when the keyboard  Appears, the navigation controller ' s navigationbar toolbar will be  Hidden. the bars will remain hidden when the keyboard dismisses,  but a tap in the content area will show them.      @availability (ios, introduced=8.0)     var  Hidesbarswhenkeyboardappears: bool    /// when the user swipes,  the navigation controller ' s navigationbar & toolbar will 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 will hide or show due to  a swipe. Do not change 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 be occupied by these bars will reveal the bars.     @availability (IOS,  introduced=8.0)     var hidesBarsWhenVerticallyCompact: Bool     /// when the user taps, the navigation controller ' s  Navigationbar & toolbar will be hidden or shown, depending on  the hidden state of the navigationBar. The toolbar will  only be shown if it has items to display.    @ Availability (ios, introduced=8.0)     var hidesBarsOnTap: Bool     /// The gesture recognizer used to recognize if the  Bars will hide or show due to a tap in content. do  not change the dElegate or attempt to replace this gesture by overriding this  method.     @availability (ios, introduced=8.0)     unowned ( unsafe)  var barhideontapgesturerecognizer: uitapgesturerecognizer { get }}

Not to miss the navigation interaction of iOS 8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.