In pod file DropDown.swift do following changes for custom height
Step 1 : Add this below width property
public var height: CGFloat? {
didSet { setNeedsUpdateConstraints() }
}
Step 2 : In public override func updateConstraints() do this
replace
`heightConstraint.constant = layout.visibleHeight `
with following
if let height = self.height {
if layout.visibleHeight >= height {
heightConstraint.constant = self.height ?? layout.visibleHeight
} else {
heightConstraint.constant = layout.visibleHeight
}
} else {
heightConstraint.constant = layout.visibleHeight
}
Step 3 : In fileprivate func computeLayoutForTopDisplay(window: UIWindow) -> ComputeLayoutTuple do this
replace
if y < windowY {
offscreenHeight = abs(y - windowY)
y = windowY
}
with following
if y < windowY {
offscreenHeight = abs(y - windowY)
if let height = self.height {
y = anchorViewMaxY + topOffset.y - height
} else {
y = windowY
}
}
Uses
let dropDown = DropDown()
dropDown.height = 50
If height is not set, the dropdown height will be its content size and if content size is greater than screen/superview size then it will stop at view bounds and dropdown's scroll is activated.
If you don't want that set height as suggested above.
After setting height:-
if your content size is less than your assigned height it will wrap to its content means dropdown will have height of its content size, you will see all dropdown option in list.
If content size exceeds assigned height then dropdown will have its assigned height and scroll will be activated.
In pod file DropDown.swift do following changes for custom height
Step 1 : Add this below width property
Step 2 : In public override func updateConstraints() do this
Step 3 : In fileprivate func computeLayoutForTopDisplay(window: UIWindow) -> ComputeLayoutTuple do this
replace
with following
Uses
If height is not set, the dropdown height will be its content size and if content size is greater than screen/superview size then it will stop at view bounds and dropdown's scroll is activated. If you don't want that set height as suggested above. After setting height:-