swiftheadernstableviewappkit

How to always show right most part of NSTableView header text?


Let's say I have a NStableView column with ThisIsMyVeryVeryLongName header title. When I reduce the width of column by resizing, it usually shows like this ThisIsMyVery... (showing extra info is on the right side).

How do I change this to ...VeryLongName upon column width reduction.

(right alignment doesn't seem to work)


Solution

  • On UILabel you can set Line break to Truncate Head. This will do what you need.

    yourLabel.lineBreakMode = .byTruncatingHead