2016-07-25 39 views
0

Ich folgte dieser Anleitung Implementing a Container View Controller, um einen Container zu erstellen, die Anmeldung/Abmeldung in der App behandelt.Verhindern Sie UINavigationBar Animation in benutzerdefinierten Container

Kinder sehen Controller sind: UINavigationController für Login und UITabBarController für den Rest der App:

diagram

Mein Problem ist, dass UINavigationBar seltsam belebt, und ich will seine Animation verhindern:

transition

Die Animation Code ist im Grunde diese (full project code here):

let current = childViewControllers.first 
    current?.willMoveToParentViewController(nil) 

    child.securityContainer = self 
    addChildViewController(child) 

     child.view.frame = newChildOriginFrame 

     UIView.transitionWithView(view, duration: 0.3, options: [], animations: { 

      child.view.frame = newChildTargetFrame 
      current?.view.frame = oldChildTargetFrame 

      self.view.addSubview(child.view) 

     }, completion: { _ in 

      child.didMoveToParentViewController(self) 
      current?.view.removeFromSuperview() 
      current?.removeFromParentViewController() 
      current?.securityContainer = nil 
     }) 

Wie kann ich die Animation von UINavigationBar verhindern?

Antwort

0

es fest von addSubview außerhalb Animationen beweglichen Block:

let current = childViewControllers.first 
current?.willMoveToParentViewController(nil) 

child.securityContainer = self 
addChildViewController(child) 

    child.view.frame = newChildOriginFrame 

    view.addSubview(child.view) 

    UIView.transitionWithView(view, duration: 0.3, options: [], animations: { 

     child.view.frame = newChildTargetFrame 
     current?.view.frame = oldChildTargetFrame 

    }, completion: { _ in 

     child.didMoveToParentViewController(self) 
     current?.view.removeFromSuperview() 
     current?.removeFromParentViewController() 
     current?.securityContainer = nil 
    }) 

(full project source code)