-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the autolayout constraints in a xib are ignored #395
Comments
I think your cell.height should return from row setup method... cell.height = { UITableViewAutomaticDimension } Could you confirm that this works for you? I'm not sure if you also need to update tabeView's
|
umm.. i didn't know about it, anyway it's not working, i'm still getting an autogenerated constraint that reduce my cell height: |
@hariseldon78 Could you share the code by uploading a project to reproduce the issue? |
sure, i'll do that after dinner |
Ok, here is the project. My original cell is "ResizingLabelCell", but i made another simpler cell with just a label. The label is configured with "0 lines" and "Word wrap", so it should expand to the size of the text. Also, if you look with "View debugging -> capture view hierarchy" you'll see that the constraint which set the height of the label is consistent with the content, but then there is the "encapsulated layout height" which ruins everything... |
Hey, I think i've got something: if i modify the Core.swift at row 707 like this:
and comment the Why? I have no idea. Just another of the thousand quirks of UITableView i guess.. Could you please give me some feedback about if this patch is acceptable or maybe it breaks something else? |
I don't remember why i put these code into willDisplayCell, apparently it works perfectly after deleting these method and adding the Apparently we don't even need the following line |
fix issue xmartlabs#395
i'm trying to create a custom cell providing a xib and a setup method.
My cell has all the autolayout constraints needed to adapt to the quantity of text in the labels, but the library uses the height closure to compute cell height (forcing me to recalculate what the constraints are alredy doing, and to keep the closure updated every time i tweak the xib)
that is wrong, it should use the constraints and dynamically size the cells.
The text was updated successfully, but these errors were encountered: