Omer
Omer

Reputation: 5600

How to dynamically populate NSOutlineView's columns?

I have an IBOutlet to an NSOutlineView and I want to remove the existing columns and add the new ones.

I have tried this to add columns

[outlineView setOutlineTableColumn:myNewCol];

and

[outlineView addTableColumn:myNewCol];

with no luck.

To remove I tried this:

NSArray *existingColumns = [outlineView tableColumns];
for (NSTableColumn *col in existingColumns)
    [outlineView removeTableColumn:col];

Any help?

Thanks!

Upvotes: 1

Views: 1116

Answers (1)

Peter Hosey
Peter Hosey

Reputation: 96353

setOutlineTableColumn: sets the column that has disclosure buttons in it. It doesn't add columns.

If both of those are simply not doing anything, make sure outlineView (which, I assume, is an IB outlet) is connected in your nib.

If something else happens, please tell us what in your question.

Upvotes: 1

Related Questions