开发者

Displaying a NSCell with the number of children its row has

开发者 https://www.devze.com 2023-01-05 22:31 出处:网络
I would like a NSCell in an OutlineView to display the number of the children the row it\'s has. Here\'s what I mean:

I would like a NSCell in an OutlineView to display the number of the children the row it's has. Here's what I mean:

Displaying a NSCell with the number of children its row has

(source: sourceforge.net)

What's on the right开发者_运维技巧, but for all rows.

How would I go about finding out, first, which row the NSCell is and then from there getting the number of children that row has.


PXSourceList does this.

edit re: the comment about displaying the number of children in the badge

If you use the excellent PXSourceList, then you'll simply implement a single delegate method:

- (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item;

Most likely, you'll implement this as:

- (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item {
  return [self sourceList:aSourceList numberOfChildrenOfItem:item];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消