Isaac Zhang
Isaac Zhang

Reputation: 1

Navigation Controller popToRootController() followed by pushing controllers UI bug

In my app I'm currently calling navigationController.popToRootController() followed by immediately pushing a few controllers onto the stack, but it's causing a weird UI bug. Instead of appearing from the left side, the new controller being presented appears from bottom up, and the weird thing is the navigation bar at the top of the screen is completely gone. Can't navigate back, can't interact with any of the navigation items ... just gone. Wondering if it has to do with popping to the root controller then immediately trying to push new controllers that could cause this weird bug. Hope someone has an insight into this. Thanks!

fileList is a navigation controller

fileList.popToRootController()
fileList.clearList()
var isRoot = true
for file in (deepLinkFolder?.fileList)! {
    // push file controller onto navigation controller (fileList)
}

Upvotes: 0

Views: 78

Answers (1)

Shehata Gamal
Shehata Gamal

Reputation: 100503

If you want to alter the viewControllers like this pop followed by a push it's better to re set the viewControllers property like this , the glitch may be because both the pop and the push have animated setted to true so interfering happens

self.navigationController?.viewControllers = []

or with animation

self.navigationController?.setViewControllers([],animated:true)

Upvotes: 1

Related Questions