pavankataria / SwiftDataTables

A Swift Data Table package, display grid-like data sets in a nicely formatted table for iOS. Subclassing UICollectionView that allows ordering, and searching with extensible options.
MIT License
448 stars 69 forks source link

Allow text to wrap up to the next line #36

Open hamzabinamin opened 5 years ago

hamzabinamin commented 5 years ago

Would be really helpful to wrap longer text on to the next line instead of making the font smaller.

hamzabinamin commented 5 years ago

@pavankataria did you get a chance to take a look at this?

pavankataria commented 5 years ago

Hi @hamzabinamin, yes, this is again related to autolayout and it's not something I've tried to resolve just yet since it's quite complicated having had to create auto calculating cell heights in collection views. In the past I resorted to using what I believe is called a self sizing class but it got ugly in terms of coding and doesn't fair well when there's varying types of cells.

I have a hard time figuring out how I'm going to resolve this as this requires the autolayout engine to calculate what the height of the cell will need to be and I'm not sure how to achieve this the correct way.

I'd be very interested to have someone explore this issue further and finding out potential ways to resolve automatic height calculation with autolayout. I'd also be interested in a one for all solution but also for an interim solution that doesn't require the use of self sizing cell classes.

hamzabinamin commented 4 years ago

@pavankataria Its been a while, hope you're doing okay!

Has there been any update regarding this feature?

pavankataria commented 4 years ago

Hi @hamzabinamin I'm afraid until an elegant solution hasn't been found I can't implement it. I don't want to explore hacky options as there needs to be a long term solution. I'll need some help in this regard but waiting for the right individual to come along who has experience in creating custom UICollectionView layouts which works well with Autolayout. It's actually harder than it seems. Sorry for now.

pavankataria commented 4 years ago

I am working on this, as you can see in this prototype I'm working on you can see cells self size just fine, the issue is that the other cells don't expand their height which would look visually more appealing. image

hamzabinamin commented 4 years ago

@pavankataria Before populating the cells, can't we calculate the max number of lines a value can utilize and update the table view row height for all cells?

pavankataria commented 4 years ago

It's hacky and only sort of works for this scenario, it's not a scalable solution. Imagine cells that can have any kind of view which doesn't depend on textfields. For example a button, or an image etc, they should also self size. The behaviour we want is that the cells in the same row should resize to the tallest cell after the autolayout engine has calculated the heights of all the cells in the row.

I'm still working on a solution. It may take a while but I'm working on a viable solution.

hamzabinamin commented 1 year ago

@pavankataria Were you able to figure out something?