Custom cell class in UITableView with static cells

Viewed 3030

I have a UITableView with static cells in a Storyboard. The static cells are of a custom class. I would like to wire up the outlets for the cell but it seems like this is not supported?

Wiring the views onto the ViewController works, but is rather messy (there are lots of cells). A workaround would probably also be to tag the views, but also not ideal. Any other ideas?

enter image description here

2 Answers

You cannot control-drag your UIView to the source file. However, you can link up the other way around.

  1. In Storyboard, select your static cell, and setup the Custom Class.
  2. In your custom class, add all the @IBOutlet as you need.
  3. Go back to Storyboard, select your static cell, and in Inspector, select Show the Connections Inspector (the last tab).
  4. Drag the Outlets there to your UIView(s).

If you use "assistant editor", you will see the circle in front of @IBOutlet is now filled (hooked).

Related