简体   繁体   English

animateWithDuration 无法识别?

[英]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 then fade them in one at a time.我正在尝试通过使用块 animation 淡出、更改文本然后一次淡入一个来对三个 UILabel(display1、display2、display3)进行交叉溶解。 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.我正在使用 Xcode 4.0 和 4.3 的 iOS 构建目标。

You want to use你想用

+ animateWithDuration:delay:options:animations:completion:

instead.反而。 Note the options: in the middle.注意options:在中间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM