NSTableViews in NSOutLineViews - macos

I have a requirement to fill the outline view with table views as shown in the image. There will be only one child table view for each nsoutlineview node. The number of table views is not static. So, I will need to implement the NSOutlineView programmatically.
![Outline view named "Command" as shown in the the image][1]
Can somebody please suggest on, how to go ahead with the requirement?
Thanks!!

The above is NOT an outline view with table views as children. It's achieved with an NSOutlineView using a root node for "Xcode Menu" and "File Menu" as root nodes and all the children as leaves. Turn on header rows (it's a header row if it's a root node) and that's that.

Related

How to create a page that leads to multiple scrollviews in swift

The beginning page is a table view. On the table view there is table that contains four different topics(picture provided). I would like each topic to lead to a new page that is a scroll view. I have successfully programmed so that the first topic will lead to a scroll view. However, I am having trouble creating more than one scroll view page for each topic. enter image description here
How to:
Create destination view controllers in your storyboard.
Create segues by CTRL-dragging from cell to the view controller that should be shown when the cell is tapped.

View based NSTableView: how to get the clicked row index?

When right clicking on a cell view in a view based table view with an assigned menu the cell's row gets a blue outline and the context menu appears. How do I get the index of that row? The property clickedRow only works for cell based table views.
Note: my question is significantly different in that I need a solution for menu updates es explained previously:
I need the clicked row in the menuNeedsUpdate function when creating the new menu.
It appears that clickedRow indeed also works for view based table views, but it's not yet set in menuNeedsUpdate. So it cannot be used to adjust the items in the menu (e.g. show specific items only that apply to the clicked row). However, you can use the menu validation to enable/disable entries (there the clicked row value is set finally).

Difference Between NSOutlineView and NSTableView

Tell me the difference between NSOutlineView and view based NSTableview as I know view based table view may not contain tree controller and NSOutlineView can have tree controller object
is it true or wrong
Apple says it best:
NSOutlineView is a subclass of NSTableView that lets the user expand
or collapse rows that contain hierarchical data. As in a table view,
an outline view displays data for a set of related items, with rows
representing individual items and columns representing the attributes
of those items. Unlike a table view, items in an outline view are not
in a flat list, but rather may be organized in a hierarchy, like files
and folders on a hard drive, or managers and employees in an
organization.
So, yes, what you say is true.

How to NOT display certain nodes in outline view?

In Apple's Mail app, in the outline view on the left, an inbox or a folder is shown in hierarchy but the emails in the folder or email is not shown at all.
I would like to reproduce this feature.
I have an outline view connected to a tree controller. Objects (nodes) are added to the tree controller and displayed in the outline view. How can I prevent some objects from appearing? Specifically, I have folder nodes that contain instances of a custom object. Just as in Mail.app, I would like to only display the folder in the outline view and will have the custom objects displayed in another view.
Some controller code as per request; here I am adding nodes to a folderNode that is selected in the outline view:
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.
Are you using any other tree controllers which need to continue on to the children?
If not, just have the folder nodes return YES to -isLeaf (and nil for the childNodes key).

Is it possible to have a button in each row of a table view in Xcode?

I have a table view loaded with 3 pieces of data in each row, formatted using a Table View Cell in IB. I would like to "hide" one piece of data with a button, that when pushed, will then be hidden so that the data that is behind the button will then be displayed.
Does anyone know if this is possible? I put my button in the Table View Cell, but I can't figure out how to get it set to the proper class in the File Owner.

Resources