Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes the difference of cell-based NSTableView and view-based NSTableView?

Tags:

If my understanding is not wrong, cell-based NSTableView and view-based NSTableView is same type of instance. Then, how cpu distinguish cell-based and view-based?

As far as I know, delegate method is different between cell-based and view-based. Cell-based NSTableView needs tableView:objectValueForTableColumn:row: and view-based NSTableView needs tableView:viewForTableColumn:row:. Is there anything which decides the instance of NSTableView behave cell-based or view-based?

like image 432
user2100702 Avatar asked Mar 25 '13 20:03

user2100702


1 Answers

In addition to following description I would suggest you to go through http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/Introduction/Introduction.html

In OS X version 10.6 and earlier each individual cell within a table view was required to be a subclass of NSCell. This approach has caused limitations when designing complex custom cells, typically requiring the developer to write their own NSCell subclass. Additionally, providing animation, such as progress views, was extremely difficult.

In OS X version 10.7 table views have been redesigned and now support using views as individual cells. These are referred to as view-based table views. View-based table views allow you to design custom cells in the Interface Builder portion of Xcode 4.0. It allows easy design time layout as well as making it easy to animate changes and customize drawing. As with cell-based table views, view-based table views support selection, column dragging, and other user-expected table view behavior. The only difference is that the developer is given much more flexibility in design and implementation.

Creating view-based and cell-based table views and adding columns use the same techniques within Interface Builder. The differences occur in your application code when providing the individual cells, populating the content of the table view, and customizing the table view appearance. As well, the Cocoa bindings techniques are entirely different between the two implementations.

like image 124
nkongara Avatar answered Sep 21 '22 13:09

nkongara