官术网_书友最值得收藏!

Hiding navigation bar

  • You can at any time hide or show the navigation bar based on any logic you have in your app by calling:
     self.navigationController?.setNavigationBarHidden(true, animated: true) 

Passing true to the preceding function hides the bar, and passing false will show the bar. Also, you can specify whether you want to do it with animation or not.

  • UINavigationController has another awesome property called hidesBarsOnSwipe when you set it to true. The navigation bar will be hidden automatically when you swipe up a table view or a scroll view. Also, when you swipe down, it will be shown again. This feature is very nice, as it saves a lot of space for the user while scrolling a list of data to see as much data as possible on screen. Let's give it a shot; from our preceding example, open MasterViewController and add this line of code in the viewDidLoad function:
     self.navigationController?.hidesBarsOnSwipe = true 
  • Then, build and run; you will note the bar hides or shows while scrolling:

主站蜘蛛池模板: 巴塘县| 梅州市| 分宜县| 龙门县| 唐河县| 水富县| 泸西县| 蒲城县| 永寿县| 竹北市| 西畴县| 博罗县| 永城市| 通城县| 诸暨市| 乌拉特前旗| 十堰市| 揭东县| 屏南县| 西乌珠穆沁旗| 徐闻县| 抚州市| 南昌县| 崇左市| 安达市| 绥德县| 韶关市| 仙游县| 娱乐| 钟山县| 大连市| 顺昌县| 区。| 冀州市| 潮安县| 略阳县| 崇礼县| 新野县| 苏尼特右旗| 益阳市| 黔江区|