Error: Parameter name omitted
I'm trying to have an auto reversing animation, and am getting the above error on the "completion:^(BOOL)finished{" line.
开发者_运维问答 [UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationOptionAutoreverse
animations:^{
[[[self dieButtons] objectAtIndex:i] setTransform:CGAffineTransformMakeTranslation(0, 200)];
}
completion:^(BOOL)finished{
}];
Note I first attempted this with the following code but the button jumped to the new location at the end of the animation.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationRepeatAutoreverses:YES];
[button setTransform:CGAffineTransformMakeTranslation(0, 200)];
[UIView commitAnimations];
finished
is the name of the BOOL
parameter, and Objective-C blocks have C-style function signatures, so it has to be in the parentheses.
The block's signature is supposed to look like this:
^(BOOL finished) {
}
精彩评论