Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. sometimes crash EXC_BAD_ACCESS with no message (set NSZombieEnabled)
  2. int currPower = [[powers objectAtIndex:i] intValue];
  3.   int prevPower = [[powers objectAtIndex:i - 1] intValue];
  4.        
  5. powers = [[NSMutableArray alloc] initWithCapacity:POWER_ARRAY_SIZE];
  6.        
  7. - (void)dealloc {
  8.      [powers release];
  9.      [super dealloc];
  10.   }
  11.        
  12. - (void)drawRect:(CGRect)rect
  13.   {
  14.      ...//Do Something
  15.      ...//Check "endindex" and "startindex" not to exceed boundary
  16.  
  17.      for (int i = endindex; i > startindex; i-=1)
  18.      {
  19.  
  20.         int currPower = [[powers objectAtIndex:i] intValue];
  21.         int prevPower = [[powers objectAtIndex:i - 1] intValue];
  22.  
  23.         ...//Doing something
  24.  
  25.      }
  26.   }
  27.        
  28. - (void)setPower:(int)p
  29.   {
  30.  
  31.      [powers addObject:[NSNumber numberWithInt:p]];
  32.  
  33.      while ([powers count] > POWER_ARRAY_SIZE){
  34.         [powers removeObjectAtIndex:0];
  35.      }
  36.   }
  37.        
  38. int power[ARRAYSIZE];