NSOutlineView parentobject
NSOutlineView parentobject
- Subject: NSOutlineView parentobject
- From: "Banupriya K" <email@hidden>
- Date: Wed, 3 Feb 2010 09:55:12 +0530
- Thread-topic: NSOutlineView parentobject
Hi all,
I have an outlineview to display n number of groups(Example: Grp1, Grp2 etc), each can have n number of items, same item can be present in many groups.
Suppose item1 is present in Grp1 and Grp2, if i have to delete item1 in Grp1, i have to access the parent object i.e Grp1.
But when i return parent object it always returns recent parent object i.e Grp2.
Can anyone please help me out to return the appropriate parent object?
Following is my implementation:
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
if ([[[tableColumn headerCell] stringValue] compare:@"Key"] == NSOrderedSame)
{
if ([item isKindOfClass:[NSString class]] && [outlineview isExpandable:item] == NO)
{
return item;
}
else if (([item isKindOfClass:[NSArray class]]))
{
if((item == [dictionary objectForKey:@"All"]))
{
return [NSString stringWithFormat:@" All"];
}
else if ((item == [dictionary objectForKey:@"RecentCalls"]) && (flag == YES))
{
return [NSString stringWithFormat:@"Recent Calls"];
}
else
{
unsigned count = 0;
unsigned keyCount = [[dictionary allKeys] count];
while (count <= keyCount) {
if ((item == [dictionary objectForKey:[[groupList allKeys] objectAtIndex:count]]))
{
return [NSString stringWithFormat:@"%@",[[groupList allKeys] objectAtIndex:count]];
}
else {
count++;
}
}
}
}
}
[outlineview reloadData];
return nil;
}
Thanks and Regards,
Banupriya K
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden