Beginning Table Views · Subclassing Table View Cells | Ray Wenderlich


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5995-beginning-table-views/lessons/46

Hi @bdmoakley,

I seem to have mucked something up. With my subclassed cells, things look like this:

The label in the subclassed cell appears overtop the prototype cell content, justified to the left margin of the cell. In fact, if I remove the default text “Label” from the prototype cell, it looks cleaner, but still not quite right. The to-do label appears over top the checkmark, despite having set my leading space constraint to be 5 points from the checkmark label.

Have I missed something obvious, or would you have any tips as to where I can start troubleshooting and debugging this kind of issue?

Thanks,
Will

Doh, just realized I’d been using the built in textLabel property of a TableViewCell rather than our todoTextLabel property. Now I’ve learned there’s a built in textLabel property, and I make useful mistakes. :wink:

W

@billmatthews Glad you sorted it out. Cheers! :]

How do I know when to use the CocoaTouchClass and when the Swift File?^^

If you are subclassing anything in UIKit, you’ll be using cocoa touch class. You can still use them in Swift. So, if you are making a subclass of a UIViewController, then you know that it’s defined in UIKit. Of course, when in doubt, check the documentation.

2 Likes

Thank you so much for your fast reply:)