Ongoing NSTableView problems

心已入冬 提交于 2019-12-13 03:58:36

问题


I am writing my first Cocoa/OSX app. I have been having problems with an NSTableView derived class. The problems is that there is no table in the containing NSView - the table is not visible. I previously pasted my code at NSTableView is not being displayed

If you know NSTableView well and it could assist, it would greatly help. I have spent a couple of days on this, with no luck.

Additional details:

  1. NSLog shows that NSTableView subclass init() is called once. This is probably good. The method numberOfRowsInTableView() is called multiple times. I don't know whether this good or bad. The method tableView:objectValueForTableColumn:row: is never invoked. The method drawRect() of NSView is called after initialization of TableView. Yet, commenting out [super drawRect:dirtyRect]; line changes nothing.
  2. Please note that I use the same NSTableView subclass as [also] a NSTableViewDataSource. I understand that this is not the common "pattern," yet I don't see why this cannot work. If there is a logical explanation, please advise my approach is not workable.
  3. I do not use and do not want to use InterfaceBuilder.

Thank you for taking time to read my question.


回答1:


I managed to come up with the solution. See the referred page for more information, if interested. Thanks.

BTW, the best NSTableView tutorial which I have seen - one that allowed me do what I needed is at: http://www.knowstack.com/nstableview_fromcode/



来源:https://stackoverflow.com/questions/25969981/ongoing-nstableview-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!