Sorting an NSTableView

  • I have an NSTableView, filled by an NSArrayController.
    A column has "Creates Sort Descriptor" selected in InterfaceBuilder.

    And right: when I click on this column, an NSSortDescriptor gets
    created with the selector "compare:".

    Works fine; only "compare:" is quite unusable; the documentation quite
    rightly says: "If you are comparing strings to present to the end-
    user, you should typically use localizedCompare:"

    Is it possible to specify in InterfaceBuilder which selector to use
    for sorting?

    Kind regards,

    Gerriet.
  • On 30 Nov 2008, at 14:05, Patrick Mau wrote:

    > Hello Gerriet
    >
    > If you select the table column and look at the inspector window,
    > you'll find a
    > "Sort key" and "Selector" input field. These are used to create the
    > NSSortDescriptor.
    >
    > Regards
    > Patrick
    >
    > (Small screenshot attached, sorry if it's against list policy ...)

    I really should have found this myself - but somehow I expected to
    find it in the Bindings-Inspector.
    I am still trying to learn my ways in the new IB. Lots of things have
    changed since the Tiger version.

    Thanks a lot for opening my eyes!

    Kind regards,

    Gerriet.