I have a user interface button and it works correctly when I clicked. But if I press the button three times, I get an EXc_BAD_ACCESS error. I thought I released something, but could not find a solution. could you help me? Sincerely.
This is the function when I pressed the button. And in dealloc I set them free. When I track, it does not give errors in the function. I got it after the function, but I do not know where the code goes after this function.
- (IBAction) doSomething: (id)sender { [self.answerDict replaceObjectAtIndex:currentPageNumber withObject:@"1"]; [self.b setImage:nil forState:UIControlStateNormal]; [self.c setImage:nil forState:UIControlStateNormal]; [self.d setImage:nil forState:UIControlStateNormal]; [self.e setImage:nil forState:UIControlStateNormal]; UIImage *img = [UIImage imageNamed:@"a.jpg"]; [self.a setImage:img forState:UIControlStateNormal]; [img release]; }
source share