UBottomSheet
UBottomSheet copied to clipboard
Dynamic height of Bottom Sheet
Hello,
I want to use dynamic height of bottom sheet, I followed the pull to dismiss from example, created a static variable of my content height but before get content height the delegate called,
func sheetPositions(_ availableHeight: CGFloat) -> [CGFloat] { let contentHeight = StudentIDViewController.contentHeight let topPosition = availableHeight - contentHeighy let bottomePosition = 1.1*availableHeight return [topPosition, bottomePosition] }
StudentIDViewController is my bottom sheet VC.
is there another way to doing that, or how can I get my content view height before delegate call.
Thanks
spend the whole night to searching for dynamic height bottom sheet, try different libraries but this one is best of all, so I figured it out how can we use dynamic height for this,
I used separate view and xib file for bottom sheet, constraint your content view to 0 all bottom, top, trailing, leading and then set top constraint relation to greater than or equal, and set the the initial position and positions as below and set you main view background as clear
func sheetPositions(_ availableHeight: CGFloat) -> [CGFloat] {
return [0.05, 1.1].map{$0*availableHeight}
}
func initialPosition(_ availableHeight: CGFloat) -> CGFloat {
return availableHeight*0.05
}
so with all this your bottom sheet cover all the view and your content view will stick to the bottom with all content. may b this one all help others
Thanks.