I have searched all of the internet, it seems that every post on this topic leaves out one vital piece of info that i need. no matter what people tell me to do, i cannot get rid of a "undeclared identifier" error with everything/anything regarding my method for my button's action. I have picked at the code so much that it is totally jacked up. Can anyone tell me what exactly i need to to do make a proper interactive button? Everything that goes in the .m file and .h file for viewcontroller?
please don't assume that I already have a certain vital piece of code, because I might not. I am new to objective-c.
Thank you!!!!!!!! ( it is for ipad by the way, and i am avoiding using the storyboard )thanks!! i am very frustrated at this point.
here is my code so far
UIButton *add = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[add addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown];
[add setTitle:@"add new" forState:UIControlStateNormal];
add.frame = CGRectMake(100, 100, 100, 100);
[objects addSubview:add];
- (void)aMethod:(UIButton*)button
{
NSLog(@"Button clicked.");
}
And the problem isn't that it runs and then crashes, the problem is that i can't run it to begin with as long as I have this error "Use of undeclared identifier 'aMethod'"