The NSTableView -noteNumberOfRowsChanged documentation says:
Note: When using NSView-based table views this method should be avoided. The table will query the data source for the new number of rows, and properly insert (or remove) rows at the end of the table as necessary with an animation.
Unfortunately, it doesn't say what I should use instead!
I've changed my app from an NSCell-based table to an NSView-based table, in order to use (slightly) more sophisticated custom cells (which are supposedly easier to design/draw as NSViews), but I'm seeing significant performance issues, even on small tables.
I'm already calling -reloadDataForRowIndexes:columnIndexes:, and empirically that is insufficient to get it to re-query -numberOfRowsInTableView (and it gives a range exception trying to draw a row greater than the previously reported number of rows).
Is there a method I should be calling? Or are NSView-based tables simply not meant for performance-critical tables which will frequently have rows added to them?
Actually,I am still using func noteNumberOfRowsChanged()
with NSView-based tableview, it acts perfectly as planned. Without using this method,NSView-based tableview is broken. NSTableView sucks, and its documentation too.
This is how I am using this method for NSView-based NSTableView:
self.pTableView.noteNumberOfRowsChanged()
self.pTableView.reloadData(forRowIndexes: set, columnIndexes: IndexSet.init(integer: 0))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With