In my "connect4" style game I have an array representing a 7x6 grid, each "cell" in the array contains either NSNull or a UIView subclass 'CoinView'. Is the following the correct way to remove objects from the NSMutableArray and the primary view?
- (IBAction)debugOrigin:(id)sender {
int x = 0;
int y = 0;
//get the coin object form the grid
CoinView *coin = [[grid objectAtIndex:x] objectAtIndex:y];
//cancel if there's no coin there
if ([coin isKindOfClass:[NSNull class]]) { return; }
//remove the coin from memory
[coin removeFromSuperview];
coin = nil;
[[grid objectAtIndex:x] setObject:[NSNull null] atIndex:y]; //will this leak?
}
Thanks!