On Nov 19, 2013, at 8:42 PM, Quincey Morris <quinceymor...@rivergatesoftware.com> wrote:
> Here’s something puzzling, unless I’m missing the obvious: > > I’m intending to convert an outline view in an existing xib file from > cell-based to view-based. In preparation, I added the requisite delegate > method to the view controller: > >> - (NSView*) outlineView: (NSOutlineView*) outlineView viewForTableColumn: >> (NSTableColumn*) column item: (id) item { >> if (!item || !column) >> return nil; >> NSTableCellView* view = [outlineView makeViewWithIdentifier: >> column.identifier owner: self]; >> if (!view) >> return nil; >> return view; >> } > > without changing the outline view itself. Somewhat to my surprise, this > delegate method *was* called for the outline view, and had the effect of > causing all of the cells to display no value. I repeat: the outline view was > still cell-based at this stage. There’s no setting need to make it cell or view-based. It’s determined simply by what delegate methods are implemented. It must simply be checking for view-based methods before cell-based. Nothing special. > OK, ignoring that and moving on, I deleted the old outline view, added a new > one, and set it to “view-based”. Now, I find that the result of creating the > cell view in the delegate method: > >> NSTableCellView* view = [outlineView makeViewWithIdentifier: >> column.identifier owner: self]; > > isn’t a NSTableCellView at all: > >> (lldb) po view >> <NSView: 0x600000323b60> >> (lldb) po [view class] >> NSView >> (lldb) po [view objectValue] >> error: Execution was interrupted, reason: Attempted to dereference an >> invalid ObjC Object or send it an unrecognized selector. >> The process has been returned to the state before expression evaluation. > > That’s weird problem #2. The table cell view item in IB has the default class > (“NSTableCellView” in gray) in the inspector, but the outline view is not > creating a cell view of that class. Huh? The consequence is that I can’t get > a value into the text field of the cell view. Did you set up the cell's identifier? -- Seth Willits _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com