animateWithDuration not recognised?
I'm trying to do a cross dissolve on three UILabels (display1, display2, display3), by using a block animation to fade out, change text and t开发者_Python百科hen fade them in one at a time. The code I'm using is:
[UIView animateWithDuration:1.0 delay: 1.0
animations:^{
display1.alpha = 0.0;
display2.alpha = 0.0;
display3.alpha = 0.0;
}
completion:^{
[display1 setText:[NSString stringWithFormat:@"%@",[engine getstring]]];
[display2 setText:[NSString stringWithFormat:@"%@",[engine getstring]]];
[display3 setText:[NSString stringWithFormat:@"%@",[engine getstring]]];
[UIView animateWithDuration:1.0 delay:1.0
animations:^{
display1.alpha = 1.0;
[UIView animateWithDuration:1.0 delay:1.0
animations:^{
display2.alpha = 1.0;
[UIView animateWithDuration:1.0
delay:1.0
animations:^{
display3.alpha = 1.0;
} completion:nil];
} completion:nil];
} completion:nil];
}];
I get the following warnings:
Method '+animateWithDuration:delay:animations:completion:' not found*
and
'UIView' may not respond to method '+animateWithDuration:delay:animations:completion:'
I'm using Xcode 4.0 with an iOS Build Target of 4.3.
You want to use
+ animateWithDuration:delay:options:animations:completion:
instead. Note the options:
in the middle.
精彩评论