cocoa - outlineView:dataCellForTableColumn:item: has strange side effect -


I have an outline view representative and see overriding outline: datasellfortable column: items: to make my outline in buttons in the button ( See ). Here is my representative code form:

  - (see NSCell *) outline: (NSOutlineView *) View Outline Data CellForTableColumn: (NSTableColumn *) Table column item: (id) items; {Michael * myCell = [[Michael Alok] Init]; // return zero; Make me return; }  

By doing this, there is a strange side effect. In the data source of my profile view, see the method outline: ObjectFormatable column: IITM: Always get an empty value for the table.

The code is:

  - (ID) View the outline: (NSOtlineview *) Outline View ObjectWallable column: (nstable column *) Item column by item column: {Printf ("tableColumn:% S \ ttable identifier:% s \ n", [[tableColumn className] cString], [[table column identifier] cString]); Return [item value forKey: [tableColumn identifier]]; }  

and the output is:

  tableColumn: (faucet) table identifier: (null)  

is what The odd one is that when I apply the outline view, then it happens: Datasellfortable column: item: method.

Edit:

Modifying the delegation function in this way is fixing the problem:

  - (NSCell *) Outline view: (NSOutlineView *) Outline View DatacelFormational Column: (NSTableColumn *) Table Column Items: (ID) Items; {Printf ("Representative column identifier:% s \ n", [[table column identifier] cStringUsingEncoding: NSASCIIStringEncoding]); If (table column == zero) {return zero; } MyCell * aCustomCell = [[MyCell alloc] init]; Returned a custom class; }  

However, I do not really understand what's happening here. If someone can explain, then it would be useful thanks!

In NSOutlineView you have the ability to drag a whole line instead of using a single line A separate cell for each column. This first asks for a cell passing in a zero table column. If you return a cell for that call, then it uses it to attract the whole line, otherwise it is continuing and demands a separate cell for each column. Therefore, as you have found, the solution is to return a zero cell, when a zero table column is passed, things will normally be attracted to


Comments