vrwim
vrwim

Reputation: 14320

How to reuse UITableViewCells

I have 2 viewcontrollers on my storyboard, which both have a tableview. Now I would like to implement the same cells in both tableviews. Is there a way to easily reuse these cells across multiple viewcontrollers?

Upvotes: 0

Views: 721

Answers (3)

Kiran Patil
Kiran Patil

Reputation: 432

Yes, It's possible you need to create .nib file with subclassing UITableviewCell

take a look on https://medium.com/@musawiralishah/creating-custom-uitableviewcell-using-nib-xib-files-in-xcode-9bee5824e722#.u8xounci2

you get to know , how to create & use .nib file.

Upvotes: 0

Tim Bernikovich
Tim Bernikovich

Reputation: 5945

You should reuse full UITableView for this case. There is no open API for sharing cells between multiple UITableViews, but you still can reuse UITableView in case there is no moment when two controllers are shown simultaneously.

Upvotes: 1

Swapnil Dhotre
Swapnil Dhotre

Reputation: 373

Yes you can use it by using custom table view cell Example for custom table view cell

Upvotes: 3

Related Questions