animateWithDuration无法识别?

时间:2011-07-18 05:54:19

标签: ios cocoa-touch core-animation objective-c-blocks

我正在尝试在三个UILabel(display1,display2,display3)上进行交叉溶解,使用块动画淡出,更改文本然后逐个淡化它们。我正在使用的代码是:

[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];
    }];

我收到以下警告:

Method '+animateWithDuration:delay:animations:completion:' not found*

'UIView' may not respond to method '+animateWithDuration:delay:animations:completion:'

我正在使用Xcode 4.0,iOS Build Target为4.3。

1 个答案:

答案 0 :(得分:1)

您想要使用

+ animateWithDuration:delay:options:animations:completion:

代替。请注意中间的options: