How to update row heights of NSTableView with usesAutomaticRowHeights = true after column resize?

前端 未结 2 1826
情深已故
情深已故 2021-01-07 06:51

Since macOS 10.13 we can use NSTableView with automatic row heights, thanks to the new property usesAutomaticRowHeights and of course auto layout. This works qu

2条回答
  •  温柔的废话
    2021-01-07 07:15

    Something that worked for me was to include the tableViewColumnDidResize notification method in the NSTableviewDelegate. There you can call the noteHeightOfRows method of the table view. Here is an implementation:

       //Recalculate when the screen moves
       func tableViewColumnDidResize(_ notification: Notification) {
         let allIndex = IndexSet(integersIn:0..

    Here are the links to the documentation: tableViewColumnDidResize and noteHeightOfRows

提交回复
热议问题