Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 动画内部';如果';声明不起作用_Ios_Animation_If Statement - Fatal编程技术网

Ios 动画内部';如果';声明不起作用

Ios 动画内部';如果';声明不起作用,ios,animation,if-statement,Ios,Animation,If Statement,这是我的问题: 我有几个动画块,它们都执行得很好。但我还想执行一些动画,仅当特定的BOOL值为true时 BOOL正确地获取了TRUE值,代码进入了if语句,因为正在打印我的日志注释。只有动画似乎没有出现。我尝试了不同的CGPoint值,但仍然相同。 也许我错过了一些关于动画的东西 我没有经常使用它们。 任何帮助都会很好 下面是一个代码示例: // line 4 - second particle UIImageView* particle8 = [[UIImageView alloc] ini

这是我的问题:

我有几个动画块,它们都执行得很好。但我还想执行一些动画,仅当特定的
BOOL
值为true时

BOOL
正确地获取了
TRUE
值,代码进入了
if
语句,因为正在打印我的日志注释。只有动画似乎没有出现。我尝试了不同的
CGPoint
值,但仍然相同。 也许我错过了一些关于动画的东西

我没有经常使用它们。 任何帮助都会很好

下面是一个代码示例:

// line 4 - second particle
UIImageView* particle8 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"particle"]];
particle8.frame = CGRectMake(p8.x, p8.y, particleWidth, particleWidth);
[self addSubview:particle8];
[UIView animateWithDuration:2
                      delay:0
                    options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionRepeat
                 animations:^{
                     particle8.frame = CGRectMake(p7.x, p7.y, particleWidth, particleWidth); }
                 completion:^(BOOL finished){[particle8 removeFromSuperview]; }];


if (_isSmartGridOn) {
    // line 2b - first particle
    UIImageView* particle9 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"particle"]];
    particle9.frame = CGRectMake(ep.x - 5, ep.y - 5, particleWidth, particleWidth);
    [self addSubview:particle9];
    [UIView animateWithDuration:1
                          delay:0
                        options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionRepeat
                     animations:^{
                         particle9.frame = CGRectMake(p10.x, p10.y, particleWidth, particleWidth); }
                     completion:^(BOOL finished){[particle9 removeFromSuperview]; }];
}

您只是有一个输入错误或复制/粘贴错误:

particle8.frame = CGRectMake(p10.x, p10.y, particleWidth, particleWidth);
        ^ should be 9         ^^     ^^ looks like these might be wrong too

您只是有一个输入错误或复制/粘贴错误:

particle8.frame = CGRectMake(p10.x, p10.y, particleWidth, particleWidth);
        ^ should be 9         ^^     ^^ looks like these might be wrong too

您好,关于打字错误您是对的,但这并不能解决问题。我已经用不同的方式复制、粘贴和重写了很多次,以找到解决方案,出现了很多拼写错误,但即使修复了,动画也不会出现。无论如何,谢谢!:)然后我建议使用断点,逐行检查if的每一行,并确保每个变量的值都是您期望的值。您好,关于输入错误您是对的,但这并不能解决问题。我已经用不同的方式复制、粘贴和重写了很多次,以找到解决方案,出现了很多拼写错误,但即使修复了,动画也不会出现。无论如何,谢谢!:)然后我建议使用断点,逐行检查if的每一行,并确保每个变量的值都是您期望的值。您好,关于输入错误您是对的,但这并不能解决问题。我已经用不同的方式复制、粘贴和重写了很多次,以找到解决方案,出现了很多拼写错误,但即使修复了,动画也不会出现。无论如何,谢谢!:)然后我建议使用一个断点,如果,并确保每个变量的值都是您期望的值。尝试将UIViewAnimationOptionBeginFromCurrentState添加到动画选项中。尝试将UIViewAnimationOptionBeginFromCurrentState添加到动画选项中。尝试将UIViewAnimationOptionBeginFromCurrentState添加到动画选项中。