Roman Roman - 1 year ago 132
iOS Question

Custom UITableViewCell with Image and Label

I have some

using a basic or subtitle
and displaying an image/icon. The separator line is automatically indented and starts where the labels are displayed. So far so good. (see correct behavior)

Now I need a couple more labels and an image. Therefore, I created a custom
with 4 labels. Without the image they work as expected. But when I add an image to the existing standard
, the image is displayed, the separator line is indented but the custom labels are not. They overlay the image. (see wrong behavior)

Do I have to create a custom
as well to get it working correctly and how is the separator line indented on that way or is there another possibility / state of the art to do something like that?

Answer Source

I finally ended with the solution that I created an empty Interface Builder document, added a TableViewCell, put the Label and ImageView on it, set the constraints, connected everything to the corresponding *.swift file. Finish. I hoped to reuse the ImageView from the default TableViewCell but obviously that did not work correctly (or I was too stupid).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download