问题描述
可可中基于单元格的视图和基于视图的表格视图之间的主要区别是什么?
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.
基于单元格的表视图使用objectValueForTableColumn:方法,而基于视图的表使用viewForTableColumn:方法.
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.
预先感谢
推荐答案
简短答案:
单元格只能包含一个UI元素,例如文本单元格,图像视图单元格,按钮单元格等等.定制能力很差.
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.
视图可以包含多个UI元素以及其他视图.定制能力几乎是无限的.
A view can contain multiple UI elements as well as other views. The customization ability is almost infinite.
Apple建议使用始终基于视图的表视图
Apple recommends to use always view based table views
这篇关于基于视图和单元格的NSTableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!