NSTableView с пользовательскими ячейками

Вы можете использовать hg mv --after, чтобы показать, что вы уже переместили файл.

17
задан Steve McLeod 8 September 2012 в 18:26
поделиться

2 ответа

NSTableView has -tableView:dataCellForTableColumn:row:. Just create your NSCell subclass in your delegate and return it if you need customization for that row. If you're just using your custom cell for every row in the table view, you can also just use IB to set the custom cell class.

The table view will copy the cell as needed, so you can keep the cell as an instance variable if it would be more efficient. The data source methods or bindings on the table view work as they normally would, only you'll return your populated dictionary instead of a single string or number. You could also pass a custom model object directly to the tableview too, although you'll have to make it copyable, or override setObjectValue: in your cell to wrap it in an NSValue.

If it's subclassing NSCell that's giving you trouble, that can be a bit of a learning experience. Start with -drawWithFrame:inView: to draw all your custom objects, and go from there as you need more functionality.

26
ответ дан 30 November 2019 в 11:44
поделиться

Ячейка может одновременно содержать только одно значение объекта. Создайте объект модели с изображением и строкой / строкой с атрибутами в качестве свойств и заполните ими табличное представление.

Кроме того, текстовое поле является представлением. Ваша модель не должна знать ничего о своем представлении - это работа ваших взглядов.

3
ответ дан 30 November 2019 в 11:44
поделиться