Search Results

Search found 1 results on 1 pages for 'danegraphics'.

Page 1/1 | 1 

  • NSMutableArray accessing issue.

    - by Danegraphics
    I've searched and have no answer. I've created an NSMutableArray and am getting an EXC_BAD_ACCESS error in one place of access. Here. This is declaring in the .h file: NSMutableArray *buttons; ... @property (nonatomic, retain)NSMutableArray *buttons; And this is the synthesizing and implimenting: @synthesize buttons; ... - (id)init { self = [super init]; if(self != nil) { buttons = [[NSMutableArray alloc] init]; } return self; } ... -(void)addButtonWithImage:(Image*)image { Image *button = image; [buttons addObject:button]; [button release]; } ... -(void)replaceButtonAt:(int)num with:(Image*)image { Image *button = image; [buttons replaceObjectAtIndex:num withObject:button]; <<===EXC_BAD_ACCESS [button release]; } But when I use this: -(void)renderButton:(int)num atPoint:(CGPoint)point center:(BOOL)center{ Image *button = [buttons objectAtIndex:num]; [button renderAtPoint:point centerOfImage:center]; } It works

    Read the article

1