FROM : Hamish Allan
DATE : Wed Jan 16 20:52:58 2008
NB to avoid compiler warnings, you can create a category on NSObject:
@interface NSObject (DisclosureTriangleAdditions)
- (BOOL)outlineView:(NSOutlineView *) shouldShowDisclosureTriangleForItem:(id);
@end
Then your method becomes:
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
{
// Default to show triangle
BOOL showTriangle = YES;
if ([[self delegate] respondsToSelector:
@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
{
showTriangle = [[self delegate] outlineView:self
shouldShowDisclosureTriangleForItem:item];
}
if (!showTriangle)
{
// If not showing triangle, return empty rect
return NSZeroRect;
}
else
{
// else return default value
return [super frameOfOutlineCellAtRow:row];
}
}
> Then, replace your outline views in IB with your custom one, and the
> delegate can implement:
>
> - (void)outlineView:(NSOutlineView *)
> shouldShowDisclosureTriangleForItem:(id)item
Don't forget to declare this with a non-void return type :)
Hamish
DATE : Wed Jan 16 20:52:58 2008
NB to avoid compiler warnings, you can create a category on NSObject:
@interface NSObject (DisclosureTriangleAdditions)
- (BOOL)outlineView:(NSOutlineView *) shouldShowDisclosureTriangleForItem:(id);
@end
Then your method becomes:
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
{
// Default to show triangle
BOOL showTriangle = YES;
if ([[self delegate] respondsToSelector:
@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
{
showTriangle = [[self delegate] outlineView:self
shouldShowDisclosureTriangleForItem:item];
}
if (!showTriangle)
{
// If not showing triangle, return empty rect
return NSZeroRect;
}
else
{
// else return default value
return [super frameOfOutlineCellAtRow:row];
}
}
> Then, replace your outline views in IB with your custom one, and the
> delegate can implement:
>
> - (void)outlineView:(NSOutlineView *)
> shouldShowDisclosureTriangleForItem:(id)item
Don't forget to declare this with a non-void return type :)
Hamish
| Related mails | Author | Date |
|---|---|---|
| Kyle Sluder | Jan 11, 15:16 | |
| Jean-Daniel Dupas | Jan 11, 15:24 | |
| Jonathan Dann | Jan 11, 16:12 | |
| Corbin Dunn | Jan 16, 00:15 | |
| Kyle Sluder | Jan 16, 11:23 | |
| Corbin Dunn | Jan 16, 19:08 | |
| Ben | Jan 16, 19:55 | |
| Corbin Dunn | Jan 16, 20:49 | |
| Hamish Allan | Jan 16, 20:52 | |
| Pete Callaway | Jan 17, 09:34 |






Cocoa mail archive

