   }
   
   func hideTabBarOnCancel() {
+    self.tabBar.layoutIfNeeded()
     self.tabBarBottom.constant = -self.tabBarHeight.constant
     UIView.animateWithDuration(self.animationDuration, animations: {
-      self.view.layoutIfNeeded()
+      self.tabBar.setNeedsLayout()
+      self.tabBar.layoutIfNeeded()
       })
     { (done) in
       if done {

    }
    
    if !self.swipeBackCancelled {
      let windowSize = self.view.frame.size.width
      let percent = Double(position) / Double(windowSize)
      let calculated = (self.tabBarHeight.constant * CGFloat(percent)) - self.tabBarHeight.constant
      self.tabBarBottom.constant = calculated
    }
  }
}

  }
  
  func showTabBar() {
    self.tabBar.layoutIfNeeded()
    self.tabBarBottom.constant = CGFloat(self.bottomPosition)
    
    UIView.animateWithDuration(self.animationDuration, animations: {
      self.tabBar.setNeedsLayout()
      self.tabBar.layoutIfNeeded()
      }) { (done) in
        if done {
          if !self.manualTransition {
