Hello,
I have been trying to develop an app which contains self sizing Table View Cells. I've looked a lot into tutorials and online documentation and came across these two lines of code:
The cells would work as following (see attachment):
The user can write something and choose whether to upload or not an image. The cell would resize according to whether there is in fact an image or not and also according to the text size.
My problems are:
- I am using a label to hold the text, already set to 0 lines. But I cannot put de text aligned to top left. There is a limit to what the user can write;
- The UIImageView that holds the image is also on a fixed size and the image is set on aspect to fit (I could not come up with a better solution);
- The code that I've shown above didn't do anything. Should I uncheck something or do something within the cell properties?
- How should I set my constraints? Of both the label and the UIImageView?
I have been trying to develop an app which contains self sizing Table View Cells. I've looked a lot into tutorials and online documentation and came across these two lines of code:
Code:
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = UITableViewAutomaticDimension (tried 44 here also)
The cells would work as following (see attachment):
The user can write something and choose whether to upload or not an image. The cell would resize according to whether there is in fact an image or not and also according to the text size.
My problems are:
- I am using a label to hold the text, already set to 0 lines. But I cannot put de text aligned to top left. There is a limit to what the user can write;
- The UIImageView that holds the image is also on a fixed size and the image is set on aspect to fit (I could not come up with a better solution);
- The code that I've shown above didn't do anything. Should I uncheck something or do something within the cell properties?
- How should I set my constraints? Of both the label and the UIImageView?
Attachments
Last edited: