ios - animateWithDuration 无法识别?

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

我正在尝试对三个 UILabel(display1、display2、display3)进行交叉溶解,方法是使用 block 动画淡出、更改文本,然后一次淡入一个。我使用的代码是:

[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 构建目标为 4.3。

最佳答案

您想使用

+ animateWithDuration:delay:options:animations:completion:

相反。请注意中间的选项:

关于ios - animateWithDuration 无法识别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6729085/

相关文章:

ios - 如果我的 WidgetKit 正在被使用,如何查询 WidgetKit?

ios - 为什么 swift 函数要编译 25 次?

ios - iOS 中的触摸事件传播

ios - 为什么在向图层添加子图层时缺少隐式动画?

iphone - 如何在 iPhone 上显示进度指示器覆盖/HUD?

iphone - 无法在 scrollViewDidEndDragging 中设置 ContentOffset

ios - 快速获取可用 wifi 网络列表并连接到其中之一

ios - 运行时找不到方法

objective-c - UIView 方向不正确

ios - 在 minimumFontSize 之后获取 UILabel 字体 pointsize