SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.32k stars 746 forks source link

How to adjust height SwiftMessagesSegue with UITableView content size? #422

Closed lutluthfi closed 4 years ago

lutluthfi commented 4 years ago

The case is start from fetching data from CoreData and displayed it onto UITableView. But I need the height of view controller is adjusting to UITableView content size. Could you give me the sample code or any answer how to do that?

wtmoose commented 4 years ago

I'm not sure I understand your end goal, but it doesn't seem specifically related to SwiftMessages. Maybe StackOverflow would be a better forum for this?

lutluthfi commented 4 years ago

My goal is after view controller being presented with SwiftMessagesSegue, the height of view controller could be changed according to the content size table view

wtmoose commented 4 years ago

Put a height constraint on the table view

lutluthfi commented 4 years ago

Cool, I think we should define the height of messageView variable in SwiftMessagesSegue. Because I try to add more UITableViewCell in demo project is not working. Thanks, so if I want to limit the height, I have to limit the height constraint of UITableView too?

wtmoose commented 4 years ago

The table view in the demo is embedded in a navigation controller. That’s different because navigation controller has it’s own sizing behavior. You can put a height constraint on messageView if you want

wtmoose commented 4 years ago

Also, check the APIs. The message view has a property for setting the height of the background view backgroundHeight

lutluthfi commented 4 years ago

That's mean the approach won't work if I am using UINavigaitonController? Yes, I was use backgroundHeight to set the height before