无法使用 CATiledLayer 正确设置视图动画

发布于 2024-10-03 13:07:08 字数 703 浏览 0 评论 0原文

带有 CATiledLayer 的 UIView 可以有动画吗?

如果我调用以下内容:

[myContentView setNeedsDisplay];

CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:self.view 缓存:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:10]; [UIView提交动画];

如果 UIView 是没有 CATiledLayer 的“普通”UIView,这将很有效。但是,一旦我添加了 CATiledLayer 类型的子图层,动画就无法正常工作。 页面翻转有效,但在动画完成之前不会显示底层页面(只是空白)。

我已经尝试过 [myContentView setNeedsDisplay];在动画块之前、之后甚至中间。如果 myContentView 有 CATiledLayer,则没有区别。

任何帮助表示赞赏。

Can UIViews with a CATiledLayer have animations?

If I call the following:

[myContentView setNeedsDisplay];

CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:10];
[UIView commitAnimations];

This will work well if the UIView is a "normal" UIView without a CATiledLayer. However as soon as I add a sublayer of type CATiledLayer, the animations does not work correctly.
The page flip works, but the underlying page is not shown (just blank) until the animation is finished.

I have tried [myContentView setNeedsDisplay]; before, after and even in the middle of the animation block. No difference if myContentView has a CATiledLayer.

Any help appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

好倦 2024-10-10 13:07:08

想通了:

缓存:是];

设置为否

Figured it out:

cache:YES];

Set to NO

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文