I am having an NSTableView with a bound NSArrayController. When one or more rows are selected, I want to show the name of the selected rows in an NSTextField. If only one row is selected the value should be shown, if multiple rows are selected the content "multiple" should be shown in the text field.

I set up my NSTextField bindings as follows:

NSTextField bindings

If the selection of the table view updates, e.g. I select one row the content of the text view gets the following:

(
    val1
)

If I select multiple rows the text field shows this content:

(
    val2,
    val1
)

Why is the text field not properly displaying the contents of the Array?

有帮助吗?

解决方案

By accident I found the solution. The binding has to be changed to:

self.arrayController.selection.name
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top