PDA

View Full Version : Another quickie question :-) About NSTableView




mdeh
Oct 27, 2009, 09:05 PM
I set up a NSTableView to play with. (for the drag etc). Added a NSMutArray as the "model" for a list of random words, which filled in the init method. To my surprise, the table fills when the app starts up. I looked at the docs and can find nothing about that,....but I suppose it makes sense. Why would you attach a list of objects as the datasource for a table if you did not want that table filled when you launched the app? The seems to be a whole host of calls in the the call stack that seems to trigger the "numberOfRowsInTableView". See below.

Is this expected behaviour...under the circumstances?



#0 0x10000135b in -[MyDocument(dataSource) numberOfRowsInTableView:] at TableViewDataSource.m:16
#1 0x7fff86575c8c in -[NSTableView numberOfRows]
#2 0x7fff86509624 in -[NSTableView _totalHeightOfTableView]
#3 0x7fff865095e9 in -[NSTableView _minimumFrameSize]
#4 0x7fff8650bba6 in -[NSTableView tile]
#5 0x7fff86513d61 in -[NSTableView rowsInRect:]
#6 0x7fff8652885f in -[NSTableView _dirtyVisibleCellsForKeyStateChange]
#7 0x7fff86528574 in -[NSTableView _windowChangedKeyState]
#8 0x7fff862dfffe in CFArrayApplyFunction
#9 0x7fff8646fb01 in -[NSView _windowChangedKeyState]

Thanks in advance.



Catfish_Man
Oct 28, 2009, 01:56 AM
Yeah, -numberOfRowsInTableView: gets called a ton. Make sure it's quick :)

mdeh
Oct 28, 2009, 06:27 AM
Yeah, -numberOfRowsInTableView: gets called a ton. Make sure it's quick :)

Thanks.