 		yConstraint.constant = (anchorView?.windowFrame?.minY ?? 0) + (offset?.y ?? 0)
 		widthConstraint.constant = width ?? (anchorView?.bounds.width ?? 0) - (offset?.x ?? 0)
 		
-		let height = tableHeight()
-		var offScreenHeight: CGFloat = 0
-		
-		if let window = UIWindow.visibleWindow() {
-			let maxY = height + yConstraint.constant
-			let windowMaxY = window.bounds.maxY - UI.HeightPadding
-			let keyboardListener = KeyboardListener.sharedInstance
-			let keyboardMinY = keyboardListener.keyboardFrame.minY - UI.HeightPadding
+		let (visibleHeight, offScreenHeight, canBeDisplayed) = computeHeightForDisplay()
+		
+		if !canBeDisplayed {
+			super.updateConstraints()
+			hide()
 			
-			if keyboardListener.isVisible && maxY > keyboardMinY {
-				offScreenHeight = abs(maxY - keyboardMinY)
-			} else if maxY > windowMaxY {
-				offScreenHeight = abs(maxY - windowMaxY)
-			}
-		}
-		
-		heightConstraint.constant = height - offScreenHeight
+			return
+		}
+		
+		heightConstraint.constant = visibleHeight
 		tableView.scrollEnabled = offScreenHeight > 0
 		
-		dispatch_async(dispatch_get_main_queue(), { [unowned self] in
+		dispatch_async(dispatch_get_main_queue()) { [unowned self] in
 			self.tableView.flashScrollIndicators()
-			})
+		}
 		
 		super.updateConstraints()
 	}

	
	@objc
	func keyboardUpdate() {
		setNeedsUpdateConstraints()
	}
	
}
		}
	}
	
	private var minHeight: CGFloat {
		return tableView.rowHeight
	}
	
	private var didSetupConstraints = false
	
	//MARK: - Init's
