Abnormal transition animation in UINavigationController with custom view

151 views Asked by At

I have subclassed the UINavigationController and added a custom view (the black bar). As a side effect I have to adjust the frame of my viewController's view in viewDidLayoutSubviews() so that it is not covered by my custom view. The problem arises when I push something onto the navigation stack as seen in the image below.

You can find the code for my UINavigationController subclass here

ViewController:

override func viewDidLayoutSubviews() {
    log.debug("\(self) \n \(self.view.frame)")

    if let nav = self.navigationController as? TabbedNavigationController {
        let height = nav.view.frame.size.height - nav.navigationViewHeight
        self.view.frame = CGRect(x: 0, y: nav.navigationViewHeight , width: self.view.frame.size.width, height: height)
    }
}

enter image description here

0

There are 0 answers