UINavigationController height animation during controller transition

I am developing an iOS application in swift and am having difficulty animating during the controller transition. In particular, I implemented UINavigationControllerDelegate to listen when a specific view is clicked. When this view is clicked, I want to hide the panel at the bottom of the screen. My code works almost perfectly, however, whenever I start the animation at the height of the navigation controller, the current view (which is deleted) correctly animates its height, but the new controller that is already pressed has a new height from the animation. To put some code in it, the following function is called from my UINavigationControllerDelegate willShow function of the viewController function:

func animatePlayerVisibility(_ visible: Bool) {

    if visible == showingPlayer {
        return
    }
    showingPlayer = visible

    let height: CGFloat = visible ? 56.0 : 0.0
    self.view.layoutIfNeeded()
    UIView.animate(withDuration: 0.35) {
        self.playerHeight.constant = height
        self.viewBottom.constant = height
        self.view.layoutIfNeeded()
    }
}

'playerHeight' - IBOutlet . 'viewBottom' IBOutlet . , , .

,

self.viewBottom.constant = height

self.viewBottom.constant = height * 2.0

imgur- : http://imgur.com/a/znAim

, , .

: Storyboard

. .

EDIT: * 2. https://imgur.com/a/2a5Sw

+4
2

, UINavigationController? , ChildViewControllers. ( )

0

, !

, , , , , -, , , . , , navigationController viewController. , .

0

Source: https://habr.com/ru/post/1677123/


All Articles