         backgroundViewTopSpaceConstraint.constant = toView.bounds.height
         
         animation({
-            self.backgroundView.layoutIfNeeded()
+            self.view.layoutIfNeeded()
             self.transitionCoverView?.alpha = 0
             self.transitionCoverView = nil
         }, completion: completion)

        
        layoutContainer()
        layoutContents()
        layoutButtons()
        
        let margin = marginInsets.top + marginInsets.bottom
        let backgroundViewHeight = view.bounds.size.height - backgroundViewBottomSpaceConstraint.constant - margin

            let buttonHeight = Int((button?.bounds.height)!)
            let buttonsHeight = Int(height)
            sizeToFit(button!, buttonsHeight / buttonHeight)
            button?.layoutIfNeeded()
            
            return CGFloat(buttonsHeight + buttonHeight)
        }
