Kendrick Ledet
Kendrick Ledet

Reputation: 673

Table View Cell Prototype from Storyboard not initializing subviews

I have a custom prototype cell that I designed in Interface Builder and gave a cell identifier. It works for the view controller I defined it in, but the real issue comes when I try to use it outside of that (such as a different controller or even a search results display controller grouped with the same tableview controller...)

Trying to dequeue a cell with the exact same reuse identifier and using the same method I used in the base controller that the prototype cell was designed in on the Storyboard yields all subviews in the prototype cell to be nil...

I really don't want to have to go and initialize every single subview to get the same effect as Storyboarding doing it for me (which it SHOULD work this way imho)... Any help would be greatly appreciated!

Upvotes: 0

Views: 195

Answers (1)

rdelmar
rdelmar

Reputation: 104092

When you want to use a cell in multiple controllers, you should define it in a xib file, not in the storyboard. You should use registerNib:forIdentifier: to tell the table where to get its cell. Since you've already made the cell in the storyboard, you can just cut and paste it into an empty xib file.

Upvotes: 1

Related Questions