2

ここに画像の説明を入力

表示/非表示ボタンを非表示にする方法(ここで展開して編集)。空の文字列として設定しても、画像に示すようにデータセルの境界線が縮小します。以前はメソッド- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)itemを使用していましたが、表示/非表示の文字列を隠して完全に機能していました。しかし、問題は、outlineview が展開のみを許可し、折りたたまないことです。対応する親ノードをクリックして、一度に 1 つの親だけを展開したいと考えています。

4

2 に答える 2

10

NSOutlineViewDelegate メソッドからこのメソッドを使用します。

- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item;
于 2014-09-12T15:34:39.440 に答える
1

最後にそれを解決しました、このコードは私を助けました。

- (NSRect)frameOfOutlineCellAtRow:(NSInteger)rowIndex
{
    NSRect superFrame = [super frameOfOutlineCellAtRow:rowIndex];

    // Return NSZeroRect if the row is a group row
    if ([[self delegate] respondsToSelector:@selector(outlineView:isGroupItem:)]) {
        if ([[self delegate] outlineView:self isGroupItem:[self itemAtRow:rowIndex]]) {
            return NSZeroRect;
        }
    }


    return superFrame;
}
于 2013-05-16T05:21:48.540 に答える