I am using Core Text (for text bleed/wrap effect). Since the body of the UIView has to grow with the text and images put onto the view, I want my UIView to adjust its height accordingly.
I tried sizeToFit (on my UIView) to adjust its height according to its contents. However, the UIView doesn’t increase its height, although it can decrease it alright.
This is how my hierarchy of the UIView looks like:
[UITextView]
[UIImageView] (can be 0 or many)
How could I make my UIView adjust its height according to the contents it has?
I am putting the text in a
UITextViewand then displaying it in theUIView(using CoreText), so I basically set the height of myUIViewas:Although it isn’t an elegant solution but atleast it works alright.
PS: a better solution might be to add a right proportion of height and width (since the text wraps around the image).