Reputation: 2724
I have used this previously in my app, and having looked over everything I cannot find the difference, but for some reason when I run:
-(void)moveSelectorToDisplayPosition:(id)sender{
int givenTag = [sender tag];
UIImageView *tempImageView = [displayedSelections objectAtIndex:givenTag];
[UIView beginAnimations:@"" context:NULL];
[UIView setAnimationDuration:.3];
tempImageView.frame = CGRectOffset(tempImageView.frame, 30 - tempImageView.frame.origin.x, 240 - tempImageView.frame.origin.y);
[UIView setAnimationDidStopSelector:@selector(loadInTextForSelectedTool:)];
[UIView commitAnimations];
}
loadInTextForSelectedTool
does not get called and I cannot figure out why. No errors or anything.
This is the method I'm trying to run, could anyone let me know if they see anything amiss or maybe something I might have forgotten? I tried also setting the [UIView setAnimationDelegate:tempImageView];
but no luck :(.
-(void)loadInTextForSelectedTool:(id)sender;
Thanks.
Upvotes: 0
Views: 4130
Reputation: 448
Unless you need to run on 3.2 or earlier, you should be using block animations. They really simplify specifying what to do at the end of an animation.
Upvotes: 0
Reputation: 15238
You need to set the delegate to the controller that implements loadInTextForSelectedTool:
[UIView setAnimationDelegate:self];
Also, according to the documentation, the selector should have the following form:
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
And finally, Apple discourages the use of this animation method in iOS 4.0 or later:
Use of this method is discouraged in iOS 4.0 and later. You should use the block-based animation methods to specify your animations instead.
Upvotes: 4