Nstableview not updating
25 times a second, which seems reasonable, it takes a chunk of CPU time, and starts to get in the way of other things (like serial comms, eech). Teach me to use boxes on top of boxes to colour my UI in (!
)The only things I need to see updated, though, are a single slider (the orange glowing one) and the two text labels at the end.
Instead we’re using the column identifier which you can set in IB.
If you want to react to user selections in your code you need to implement the NSTable View Delegate Protocol and also connect your table view’s delegate to the above class.
Optionally you may also want to look into making it an NSView Controller subclass.
I also think you should still look into using NSCollection View instead of NSTable View for this purpose; your rows are highly complex and could probably benefit from having their own individual controllers. I knew there had to be a more elegant way of doing things; have to admit I posted my code in the hope someone would be able to point me in the right direction.
Your controller doesn't need to keep its own array around.This is done for efficiency - a table view may have 10,000 rows but it only needs to keep the 20 visible views in existence at any one time, and simply updating a reused view is much quicker than destroying a view and then instantiating and setting up an entirely new one.What you are doing is short-circuiting that entire mechanism and forcing all rows to have always-existing views.Here are the steps: #pragma mark - Table View Data Source - (NSInteger)number Of Rows In Table View:(NSTable View *)table View - (id)table View:(NSTable View *)table View object Value For Table Column:(NSTable Column *)table Column row:(NSInteger)row Notice that in the second method we’re not referencing the columns with a number (like we do with rows).That’s because the user could reorder or remove columns.
That's now changed (see answer to also_HIM below). 25 times per second is too often for reload Data...