I am creating 2 buttons programmatically in my view. Both selector methods exist but it is still throwing ‘unrecognized selector’ errors. I read something about checking for zombies. But I activiated it (xcode 4.2) and didn’t see anything about any zombies. Here is the code..
- (void)viewDidLoad
{
for(int i = 0; i < [list count]; i++){
... if statement checks to add text fields
}
UIButton *submit = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[submit addTarget:self action:@selector(submission:)
forControlEvents:UIControlEventTouchUpInside];
[submit setTitle:@"Submit" forState:UIControlStateNormal];
submit.frame = CGRectMake(x+ 170.0, y, 72, 37);
UIButton *addition = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[addition addTarget:self action:@selector(addition:)
forControlEvents:UIControlEventTouchUpInside];
[addition setTitle:@"Additional Mission" forState:UIControlStateNormal];
addition.frame = CGRectMake(x, y, 140, 37);
y = y+90;
[inputsView addSubview:submit];
[inputsView addSubview:addition];
[inputsView setScrollEnabled:YES];
[inputsView setContentSize:CGSizeMake(320, y)];
}
- (void)submission{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Submission Complete" message:@"Submission"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
}
-(void)addition{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Creating Additional Mission" message:@"Additional Mission"
delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
}
One thing to note.. inputsView is a UIScrollView that is inside my viewcontroller.
Thanks in advance.
remove the colon from the selector methods
the colon tells the selector that this method takes arguments, yours do not so the colon should not be part of the selector