PDA

View Full Version : Need to develop Table for settings like Build section in Project settings




i.yalovecky
Aug 31, 2010, 10:43 AM
From what i need to start? May i do it with TableView or better from scratch? May be somewhere exist something like this?



kainjow
Aug 31, 2010, 12:20 PM
If you want the collapsible style then you'll need an NSOutlineView. It looks like you might be able to use outlineView:dataCellForTableColumn:item: to get the full row appearance that Xcode uses for each setting group (e.g. Architectures, Build Locations, etc.) with a custom NSCell.

Everything else looks fairly standard though.

kainjow
Aug 31, 2010, 10:08 PM
So this is actually really easy to do. I didn't know that the gray group header style is already built-in (new in 10.5). You just need to implement outlineView:isGroupItem:. But in order to get it to look *exactly* like Xcode you need to implement outlineView:dataCellForTableColumn:item: as well and return an NSTextFieldCell. No custom classes required.

i.yalovecky
Sep 2, 2010, 05:06 AM
Great thanks, now im trying to do my task with OutlineView, for that purpose i explore DragNDropOutlineView example. And now i confused with one problem. I populate OutlineView through
- (NSArray *)childrenForItem:(id)item {
if (item == nil) {
return [rootTreeNode childNodes];
} else {
return [item childNodes];
}
}

- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
// 'item' may potentially be nil for the root item.
NSArray *children = [self childrenForItem:item];
// This will return an NSTreeNode with our model object as the representedObject
return [children objectAtIndex:index];
}

Top level showed pretty well, but with next i have EXC_BAD_ACCESS, and its really bad, its retuen NSTreeNode object with my DSimpleNodeData in representedObject, but no data there((

But it was inserted, im sure

i.yalovecky
Sep 2, 2010, 05:27 AM
Huh, it was problem in my init. Three hours wasted))