无法使用 CATiledLayer 正确设置视图动画
带有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了:
缓存:是];
设置为否
Figured it out:
cache:YES];
Set to NO