ios – 如何在UIView transitionWithView之后运行代码?

ios – 如何在UIView transitionWithView之后运行代码?,第1张

概述我希望在动画完成后运行一段代码,但编译器显示以下错误:“不兼容的块指针类型向’void(^)(BOOL)’类型的参数发送’void(^)(void)’” 这是我的代码,我不确定我做错了什么,请帮助,谢谢. [UIView transitionWithView:self.view duration:1.5 options:UIViewAnimationOptio 我希望在动画完成后运行一段代码,但编译器显示以下错误:“不兼容的块指针类型向’voID(^)(BOol)’类型的参数发送’voID(^)(voID)’”

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

[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完成){…}
[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...                }];
总结

以上是内存溢出为你收集整理的ios – 如何在UIView transitionWithView之后运行代码?全部内容,希望文章能够帮你解决ios – 如何在UIView transitionWithView之后运行代码?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1105310.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存