Reputation: 10698
I'm creating a custom UITableViewCell (MessageCell), and I'd wish to have my UITextView resizing both in width and height whenever the cell changes its size, while keeping some basic constraint like margins to the edges.
Note : I also change my cell's height in the heightForRowAtIndexPath
method depending on the content which will be placed into UITextView.
Here are all the constraints currently applied & the cell :
I tried :
UILabel
.Vertical Space
from the bottom, thinking it would change the height to fit all the constraints.Height
with an User Constraint Height >= 43
(my initial height), but the purple-automatic Height
is re-created again whenever I do this.If someone has any clue or guideline to achieve my goal, I'd appreciate!
I might add, I'm totally new to Autolayout & constraints. My reference : Ray Wenderlich's awesomeness
Upvotes: 4
Views: 3242
Reputation: 104082
You need to get rid of that height constraint that the text view has. Make sure you have constraints to something above and below the text view (usually the top and bottom of the cell), and then you should be able to delete that height constraint.
Upvotes: 3