开发者

Multiple UITableViewCell types implementation

I wanted to know what is the best way to implement multiple cell types. I have a app wherein there will be multiple types of table cells. What out of following 开发者_如何学Cwould be best approach:

1) Put all the cell types in one NIB file, tag them and then use them as needed.

2) Create different cell view classes and instantiate them as and when needed.

3) Make a generic cell controller and let server decide the type of cell to be drawn as data is being flown from server.

If there is any other approach also, please tell me.


Depending on how different the cells are, you might have a separate class for each type. You can utilize the table view's built-in cell reuse to have it cache cells of different types using different reuse identifiers.

Apple discourages loading table view cells from nibs, probably because it performs badly (i.e. results in jittery scrolling). But if you have a very complicated cell layout, it can be annoying to set it all up in code. I guess you'd just have to try it for yourself. Though I would recommend putting each different cell type into a different nib.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜