Apple のメール アプリでは、左側のアウトライン ビューで、受信トレイまたはフォルダーが階層で表示されますが、フォルダーまたはメール内のメールはまったく表示されません。
この機能を再現したいと思います。
ツリー コントローラに接続されたアウトライン ビューがあります。ツリー コントローラにオブジェクト (ノード) が追加され、アウトライン ビューに表示されます。一部のオブジェクトが表示されないようにするにはどうすればよいですか? 具体的には、カスタム オブジェクトのインスタンスを含むフォルダー ノードがあります。Mail.app と同じように、フォルダーをアウトライン ビューにのみ表示し、カスタム オブジェクトを別のビューに表示したいと考えています。
リクエストに応じたコントローラーコード。ここでは、アウトライン ビューで選択されている folderNode にノードを追加しています。
indexPath = [treeController selectionIndexPath];
indexPath = [indexPath indexPathByAddingIndex:[[[[treeController selectedObjects] objectAtIndex:0] children] count]];//want to insert the new node at the end of the folder node's array of children
...
[treeController insertObject:customObjectNode atArrangedObjectIndexPath:indexPath];
NSLog(@"No. of items selected in tree controller/outline view is %i",[[treeController selectedNodes] count]); //if the folderNode is a leaf, this gives 0, i.e. no selection
// if the folderNode is not a leaf, the added child automatically becomes selected by NSOutlineView. In that case I keep its parent selected (the folder) so the next customObjectNode can be added
[self selectParentFromSelection];//however this method will then do nothing because at this point nothing is selected. Now this whole paragraph of code cannot be repeated because nothing is selected so the first line of code doesn't work.