Pregunta

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?

¿Fue útil?

Solución

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

self.arrayController.selection.name
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top