ergunemr / BottomPopup

BottomPopup provides a popup-like presentation style to any view controller
MIT License
877 stars 88 forks source link

How to change dynamic height based array data? #37

Open karthisiva opened 3 years ago

karthisiva commented 3 years ago

I want to reload the height after data comes from server without loosing animation effect. its jerking if call this line

(self.presentationController as? BottomPopupPresentationController)?.containerViewWillLayoutSubviews()

fileprivate func adjustListHeight()-> CGFloat{ let height = UIScreen.main.bounds.size.height * 50 / 100 // if self.dataArray.count == 0{ // // return height // }else{ // if dataArray.count > 10{ // let height = UIScreen.main.bounds.size.height * 50 / 100 // return height // }else{ // return CGFloat(((dataArray.count + 1) * 44) + 70) // } // } return height } override var popupHeight: CGFloat{ return adjustListHeight() }

guneshasancan commented 2 years ago

You can call updatePopupHeight(to: CGFloat) anywhere to update height of popup.