ios - Swift / How to hide NavigationBar with Root View Controller / Page View Controller. Little gap on top of screen -


i'm using swipeviewcontroller.

it's sub class of uinavigationcontroller, uipageviewcontrollerdelegate, uiscrollviewdelegate

the view instantiated within appdelegate.swift by:

    let pagecontroller = uipageviewcontroller(transitionstyle: .scroll, navigationorientation: .horizontal, options: nil)     let navigationcontroller = viewcontroller(rootviewcontroller: pagecontroller)     self.window?.rootviewcontroller = navigationcontroller     self.window?.makekeyandvisible() 

the complete code of viewcontroller is:

import uikit import swipeviewcontroller  class viewcontroller: swipeviewcontroller {      override func viewdidload() {         super.viewdidload()          navigationbar.hidden = true          let vc1 = uiviewcontroller()         vc1.view.backgroundcolor = uicolor(red: 0.19, green: 0.36, blue: 0.60, alpha: 1.0)         vc1.title = "recent"         let vc2 = uiviewcontroller()         vc2.view.backgroundcolor = uicolor(red: 0.70, green: 0.23, blue: 0.92, alpha: 1.0)         vc2.title = "random"          setviewcontrollerarray([vc1, vc2])         setfirstviewcontroller(0)      } } 

my problem is, once app started, no matter if in simulator or physical device. there gap in exact height of status bar.

enter image description here

once press on screen, view "moves up".

enter image description here

also. 1 time i'm able grab view , grab down. screen "run back" top (like in graphic bug) , moment on, till next app start, screen "locked" window. condition want time....

enter image description here

what best practise delete "bugs", have navigationbar hidden , views locked window? appreciated.

ps. if don't hide navigationbar, there no bug @ all.

pps. can download sample project provided github link. it's same.

to solve similar problem i've created singleton class implement uinavigationcontrollerdelegate. , implemented following method:

public func navigationcontroller(navigationcontroller: uinavigationcontroller, willshowviewcontroller viewcontroller: uiviewcontroller, animated: bool) { if (viewcontroller.ismemberofclass:(youruiviewcontrollessubclass1.self)){     //or detection     navigationcontroller.navigatonbarhidden = true//or false if needed } else if (viewcontroller.ismemberofclass:(youruiviewcontrollessubclass2.self)){     navigationcontroller.navigatonbarhidden = true//or false if needed }/ ... may check others 

i wish solve problem


Comments