Вот код:
- (void)addAnswerWithNumber:(NSString *)numberAnswer
{
UIButton *aButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
[aButton setBackgroundImage:[UIImage imageNamed:@"roundBlue.png"] forState:UIControlStateNormal];
[aButton addTarget:self action:@selector(removeAnswer:) forControlEvents:UIControlEventTouchUpInside];
[aButton setTitle:numberAnswer forState:UIControlStateNormal];
aButton.enabled = YES;
aButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:18.0];
aButton.titleLabel.textColor = [UIColor whiteColor];
aButton.titleLabel.textAlignment = UITextAlignmentCenter;
[dropableZone addSubview:aButton];
[buttonList addObject:aButton];
[aButton release];
[aButton release];
if ([buttonList count] > 0) {
dropHereLabel.text = @"";
[self repositionRoundButton];
}else
{
dropHereLabel.text = @"Déposez votre ou vos Réponse(s) ici";
}
}
- (void)repositionRoundButton
{
int yPos = ((890 / 2) - (([buttonList count] * (37 + 10)) / 2));
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
for (int i = 0; i < [buttonList count]; i++) {
UIButton *aButton = [buttonList objectAtIndex:i];
aButton.frame = CGRectMake(yPos, (90 /2) - (37/2) , 37, 37);
yPos = yPos + 47;
}
[UIView commitAnimations];
}
- (void)removeAnswer:(id)sender
{
UIButton *aButton = sender;
for (int i = 0; i < [answerList count]; i++) {
AnswerView *answer = [answerList objectAtIndex:i];
if ([[aButton titleForState:UIControlStateNormal] isEqualToString:answer.number]) {
[answer.backGroundImage setImage:[UIImage imageNamed:@"qcmBlueButton.png"]];
[answer setStateToNull];
}
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0f];
aButton.alpha = 0.0f;
[UIView commitAnimations];
[buttonList removeObject:aButton];
[self repositionRoundButton];
[aButton removeFromSuperview];
[aButton release];
}
У меня есть EXC_BAD_ACCESS для int retVal = UIApplicationMain (argc, argv, nil, nil);
когда я нажимаю на кнопку создать с - (void) addAnswerWithNumber: (NSString *) numberAnswer.
Вы видите проблему в моем коде?
Спасибо.