Reuse cell from another table VC in same storyboard [duplicate]

匿名 (未验证) 提交于 2019-12-03 03:08:02

问题:

This question already has an answer here:

Lets say in storyboard I have two table view controllers (A and B). In the A controller I did create cell prototypes with identifiers: VIENS and DU. In the B controller I need to use cell with identifier DU. I do not want to create same look and feel cell prototype in the B controller once again. Is here a way to reuse cell DU from A controller in the B controller? If yes then how to do it?

回答1:

The best way to do this is to not define the cell in the storyboard at all.

Create a separate NIB file and define the UITableViewCell in there. Then you can register the nib with the table and load it from there. Now you just have one copy of the definition of the cell but it can be used in multiple places.

Check my question here...

UITableView registerNib:forCellReuseIdentifier:

It isn't a duplicate question but it will show you how to define and register the nib.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!