I’ve seen many questions regarding this topic, yet I cannot find one satisfactory answer.
I’ve created a sample view using interface builder, attached below:
Layout sample
Now the text content is dynamic, and when I have a list of such views one underneath the other, I get to a strange state in which views overlap each other. I am looking for a simple way to get my view to resize itself, or at least expend to the size of all its subviews.
All the explanations I find have to do with a single label, in which their is a manual calculations of its size. Is there no simple mechanism provided by coca toch for this?
Thank you
You will have to subclass that superview containing all those other items. Then override -layoutSubviews method and in that method calculate your sizes and reposition the subviews.