Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sometimes crash EXC_BAD_ACCESS with no message (set NSZombieEnabled)
- int currPower = [[powers objectAtIndex:i] intValue];
- int prevPower = [[powers objectAtIndex:i - 1] intValue];
- powers = [[NSMutableArray alloc] initWithCapacity:POWER_ARRAY_SIZE];
- - (void)dealloc {
- [powers release];
- [super dealloc];
- }
- - (void)drawRect:(CGRect)rect
- {
- ...//Do Something
- ...//Check "endindex" and "startindex" not to exceed boundary
- for (int i = endindex; i > startindex; i-=1)
- {
- int currPower = [[powers objectAtIndex:i] intValue];
- int prevPower = [[powers objectAtIndex:i - 1] intValue];
- ...//Doing something
- }
- }
- - (void)setPower:(int)p
- {
- [powers addObject:[NSNumber numberWithInt:p]];
- while ([powers count] > POWER_ARRAY_SIZE){
- [powers removeObjectAtIndex:0];
- }
- }
- int power[ARRAYSIZE];
Advertisement
Add Comment
Please, Sign In to add comment