FROM : Corbin Dunn
DATE : Wed Jan 16 20:49:10 2008
>
>
> Subclass NSOutlineView, and override the following method:
>
> - (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
> {
> // Default to show triangle
> BOOL showTriangle = YES;
>
> // See if delegate responds to new selector
> if ([[self delegate]
> respondsToSelector
> :@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
> {
Ah! One thing that I highly recommend changing is the selector
signature. Let's say you call your class "CDOutlineView". I'd suggest
using the selector name:
cdOutlineView:shouldShowDisclosureTriangleForItem:.
If Apple introduces the same method name in a later version of the OS
then it may conflict with yours, and it may start to be called at
different times with different parameters. This type of thing does
happen, and I'll give you an example. On Leopard we introduced:
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:
(NSTableColumn *)tableColumn row:(NSInteger)row;
However, other people implemented the same thing in a custom subclass,
and it caused compatibility problems. The solution was for people to
be forced to link against Leopard in order to use the new delegate
method, which is unfortunate (mainly because it doesn't allow people
to sort of soft-adopt it in their 10.4 apps - if that doesn't make
sense, don't worry).
corbin
DATE : Wed Jan 16 20:49:10 2008
>
>
> Subclass NSOutlineView, and override the following method:
>
> - (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
> {
> // Default to show triangle
> BOOL showTriangle = YES;
>
> // See if delegate responds to new selector
> if ([[self delegate]
> respondsToSelector
> :@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
> {
Ah! One thing that I highly recommend changing is the selector
signature. Let's say you call your class "CDOutlineView". I'd suggest
using the selector name:
cdOutlineView:shouldShowDisclosureTriangleForItem:.
If Apple introduces the same method name in a later version of the OS
then it may conflict with yours, and it may start to be called at
different times with different parameters. This type of thing does
happen, and I'll give you an example. On Leopard we introduced:
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:
(NSTableColumn *)tableColumn row:(NSInteger)row;
However, other people implemented the same thing in a custom subclass,
and it caused compatibility problems. The solution was for people to
be forced to link against Leopard in order to use the new delegate
method, which is unfortunate (mainly because it doesn't allow people
to sort of soft-adopt it in their 10.4 apps - if that doesn't make
sense, don't worry).
corbin
| 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

