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
Adjust height Dynamically #86
Comments
Hi, maybe you can hack it like this: compute the ideal height for one line and then, every time the content of that label changes, set the |
So my Xib's class calls an API to load the data into it's subviews and obviously that call is asynchronous. Which means that I might still be receiving data while the Also, will setting the I really want this library to work for me but all the headers in my app have dynamic content as I explain above so it's going to be really difficult to use this without ugly hacks.😥 |
Hi, well, you will need to keep a reference to the header view in the view controller or wherever. When you change the I would try experimenting with some user-triggered height change, like tapping some button that adds text synchronously to your label in order to test this approach. Once you get it to work, you may add your code reacting to asynchronous calls. |
Yes. The table is at its original position when I try to change the maximumContentHeight. I will try your suggestion in my dev environment today. |
@gskbyte so here is what I found. With a button which adds 10 pts to the |
OK I think I found something that does work (somewhat). I was able to expand the header using |
Alright, I give up. It won't work in this scenario, i.e. if the header view XIB has dynamic content especially in a stackview and uses autolayout. I think if we get the capability of doing With the current |
Well, if the only thing changing the height of the header view is the amount of text, then you can use that every time the height changes to set the maximumContentHeight manually... |
Yes that's how I finally ended up doing. Calculate the label height using the |
I really like this library, and so far it is working great with one small issue. I have a Xib that I use for the header view. The Xib has a vertical Stackview with one element as a
UILabel
. Now thisUILabel
gets data from API and is a multi line label. There could 1, 2,3 lines or no text at all. The Stackview also uses auto layout in the Xib and is pinned to the top, bottom, left. What I am noticing is thatGSKStretchyHeaderView
is always using the defaultmaximumContentHeight
(240) no matter what the content of the Stackview is, which is resulting in gaps being left in the header. Is there a way to calculate themaximumContentHeight
dynamically based on the content of the Stackview inside the Xib? any help will be greatly appreciated.The text was updated successfully, but these errors were encountered: