tags:

views:

42

answers:

2

Hi All,

I need to add a view to NSOutlineView.

This view contains some text field and button, while expanding the outlineview should show this view.

Please let me know how to add the view the NSOutliveView.

Thanks, Felix.

A: 

You may need to post a mock-up picture somewhere to show what you mean (particularly the expanding part).

In general, you can add a view to a subview by using -addSubview: but this tends not to work well with NSTableView and NSOutlineView.

It sounds as if you want a view (as a set of controls) to stay at the bottom of the last visible row of an outline view. That's a bit tricky because you'll need to subclass and override its sizing routine(s) to make enough room for your controls, as well as its layout routine(s) to position the controls correctly. You may also have to play with its drawing routines to fix / adjust things as needed.

More detail in your post would go a long way.

Joshua Nozzi
A: 

NSTableView and, therefore, NSOutlineView do not gracefully handle subviews. It's not possible to use a view to display content in the way you described. Instead you need to subclass NSCell; each individual field in an NSTableView or NSOutlineView is a cell.

See the Control and Cell Programming Topics for Cocoa guide for more information about how cells work.

caleb