View and Cell based NSTableView

◇◆丶佛笑我妖孽 提交于 2019-12-07 17:35:11

问题


What is the main difference between cell based and view based tableviews in Cocoa.

The understanding I have is cell based tableviews are basically used for displaying strings and view based are for custom cells.User events such as dragging rows, selection etc can be handled in view based.

cell based tableviews use objectValueForTableColumn: method and view based tables use viewForTableColumn: method.

Is my understanding correct?. Or is any other design concerns between these table views. When to go for cell based and when to go for view based.

Thanks in advance


回答1:


short answer:

A cell can contain only one UI element like a text cell, image view cell, button cell and a few more. The customization ability is quite poor.

A view can contain multiple UI elements as well as other views. The customization ability is almost infinite.

Apple recommends to use always view based table views




回答2:


NSCell is a lighter weight object and was a solution when it was a concern to have too many NSView objects. Think more than a decade ago. Cells are deprecated. Use views.



来源:https://stackoverflow.com/questions/31323234/view-and-cell-based-nstableview

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