سؤال

I think I got all the steps down but I must be missing something because I can't make a connection from the labels in the cell to the code.

Here's what I'm doing:

  1. set style of cell to custom
  2. dragging some labels onto the prototype cell.
  3. adding a new file to the project and making it a subclass of UITableViewCell
  4. in the identity inspector of the cell im trying to customize, I set its class to the new class I just created.
  5. TRY to control drag from the labels on the cell to the headerfile of the class I just created to setup an IBOutlet, but it won't let me.

What am I missing?

هل كانت مفيدة؟

المحلول

Declare the label as a property in the custom cell class. In the table view controller, alloc or dequeue the cell as your custom type, not as UITableViewCell. In the Xcode storyboard, control drag from the cell itself (for example, the far bottom right corner) to the label that is in the cell to connect the outlet.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top