Ios 如何在UIView转换WithView后运行代码?

Ios 如何在UIView转换WithView后运行代码?,ios,objective-c,uiview,uiviewanimation,Ios,Objective C,Uiview,Uiviewanimation,我想在动画完成后运行代码块,但编译器显示以下错误:“不兼容的块指针类型将'void(^)(void)'发送到'void(^)(BOOL)'类型的参数” 这是我的代码,我不确定我做错了什么,请帮助,谢谢 [UIView transitionWithView:self.view duration:1.5 options:UIViewAnimationOptionTransitionFlipFromBottom //change to whatever anima

我想在动画完成后运行代码块,但编译器显示以下错误:“不兼容的块指针类型将'void(^)(void)'发送到'void(^)(BOOL)'类型的参数”

这是我的代码,我不确定我做错了什么,请帮助,谢谢

[UIView transitionWithView:self.view duration:1.5
                   options:UIViewAnimationOptionTransitionFlipFromBottom //change to whatever animation you like
                animations:^ {
                    [self.view addSubview:myImageView1];
                    [self.view addSubview:myImageView2];
                }
                completion:^ {
                    NSLog(@"Animations completed.");
                    // do something...
                }];

您只是使用了错误的块类型:)它需要一个如下所示的块。键是
^(BOOL finished){…}

[UIView transitionWithView:self.view duration:1.5
                   options:UIViewAnimationOptionTransitionFlipFromBottom //change to whatever animation you like
                animations:^ {
                    [self.view addSubview:myImageView1];
                    [self.view addSubview:myImageView2];
                }
                completion:^(BOOL finished){
                    if (finished) {
                        // Successful
                    }
                    NSLog(@"Animations completed.");
                    // do something...
                }];