Now I've gotten myself stuck into a hole with this problem, and due to my lack of experience, I can't seem to figure out what the issue is.
I've created a dynamic UIButton and set it to the view, which is completely clickable when it's not moving on the screen. However, when I animate the button as a UIView, the button is no longer clickable.
Am I doing something wrong? How can I make it so that the button is moving from one place to another place on the screen and yet have it clickable?
Here is my code:
Code:
UIImage *dotImage = [UIImage imageNamed:@"noteBassImage.png"];
CGRect btnDot = CGRectMake(41, 41, dotImage.size.width, dotImage.size.height);
UIButton *dotButton = [[[UIButton alloc] initWithFrame: btnDot] retain];
dotButton.frame = CGRectMake(139, 0, 41, 41);
dotButton.alpha = 1.0;
[dotButton setBackgroundImage:dotImage forState:UIControlStateNormal];
[dotButton addTarget:self action:@selector(onPressBass) forControlEvents:UIControlEventTouchDown];
[dotButton setEnabled:YES];
[dotImage release];
[self.view addSubview:dotButton];
// button is clickable until here
[UIView beginAnimations:nil context:dotButton];
[UIView setAnimationDuration:6];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
dotButton.frame = CGRectMake(139, 500.0, 41, 41);
[UIView setAnimationDidStopSelector:@selector(onAnimationComplete:finished:context:)];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];