Source/Grid.m
changeset 7 428a194e3e59
parent 3 40d225cf9c43
child 8 45c82a071aca
     1.1 --- a/Source/Grid.m	Tue Mar 11 09:21:53 2008 -0700
     1.2 +++ b/Source/Grid.m	Sun Mar 16 15:06:47 2008 -0700
     1.3 @@ -124,10 +124,11 @@
     1.4  - (GridCell*) createCellAtRow: (unsigned)row column: (unsigned)col 
     1.5                 suggestedFrame: (CGRect)frame
     1.6  {
     1.7 -    return [[[_cellClass alloc] initWithGrid: self 
     1.8 +    GridCell *cell = [[_cellClass alloc] initWithGrid: self 
     1.9                                          row: row column: col
    1.10 -                                      frame: frame]
    1.11 -                    autorelease];
    1.12 +                                                frame: frame];
    1.13 +    cell.name = [NSString stringWithFormat: @"%c%u", ('A'+row),col];
    1.14 +    return [cell autorelease];
    1.15  }
    1.16  
    1.17  
    1.18 @@ -172,6 +173,16 @@
    1.19  }
    1.20  
    1.21  
    1.22 +- (GridCell*) cellWithName: (NSString*)name
    1.23 +{
    1.24 +    for( CALayer *layer in self.sublayers )
    1.25 +        if( [layer isKindOfClass: [GridCell class]] )
    1.26 +            if( [name isEqualToString: ((GridCell*)layer).name] )
    1.27 +                return (GridCell*)layer;
    1.28 +    return nil;
    1.29 +}
    1.30 +
    1.31 +
    1.32  #pragma mark -
    1.33  #pragma mark DRAWING:
    1.34