Change height of custom table cell as user types

I use the Allow Dynamic Height setting for some of my MobileTableCustomCells when, for example, I have a label with a variable amount of text and I need the height of the row to grow by anchoring the control to the bottom constraint.

This works fine when you setup the custom cell with static content. If the content is going to change dynamically, eg by responding to user action, it seems you need a delegate to call back and do a .ReloadRow to redraw the row at the changed height.

My problem is that I want a MobileTextArea to grow as the user types into it and I want my row height to grow to show the growing text area. But if I reload the row whenever my text area grows, the whole thing is redrawn and I lose the cursor position, etc. I can code around all of this but it seems a bit messy and I was wondering whether there might be a neater solution that I just haven’t discovered yet?

It seems to work with a few declares
Sample project: https://easyupload.io/wlooow

Source: ios - Swift / how to use UITextView with dynamic height INSIDE UITableViewCell with dynamic height - Stack Overflow

resizingcell

2 Likes