ios – UIViewAnimationOptionLayoutSubviews的工作原理示例?

ios – UIViewAnimationOptionLayoutSubviews的工作原理示例?,第1张

概述Apple的文档将UIViewAnimationOptionLayoutSubviews描述为: Lay out subviews at commit time so that they are animated along with their parent. 这是我感兴趣的代码示例.我希望为detailView的-layoutSubviews设置动画;但是,它似乎没有布局detailView的 Apple的文档将UIVIEwAnimationoptionLayoutSubvIEws描述为:

Lay out subvIEws at commit time so that they are animated along with
their parent.

这是我感兴趣的代码示例.我希望为detailVIEw的-layoutSubvIEws设置动画;但是,它似乎没有布局detailVIEw的子视图,所以我不确定它实际上有什么影响.

voID (^animation) () = ^    {        [self.detailVIEw setNeedsLayout];        [self.detailVIEw layoutIfNeeded];    };    [UIVIEw animateWithDuration:0.5                          delay:0.0                        options:UIVIEwAnimationoptionLayoutSubvIEws                     animations:^{                         animation();                     }                     completion:nil];
解决方法 由于您希望第二个动画从第一个动画的当前状态(无论是否完成)发生,我建议在设置第二个动画时使用UIVIEwAnimationoptionLayoutSubvIEws选项.
[UIVIEw animateWithDuration:0.2                      delay:0.0                    options:UIVIEwAnimationoptionLayoutSubvIEws                 animations:^{                     CGAffinetransform settingstransform = CGAffinetransformMakeTranslation(self.animatedVIEw.frame.size.wIDth,0);                        self.animatedVIEw.transform = settingstransform;                 } completion:nil];
总结

以上是内存溢出为你收集整理的ios – UIViewAnimationOptionLayoutSubviews的工作原理示例?全部内容,希望文章能够帮你解决ios – UIViewAnimationOptionLayoutSubviews的工作原理示例?所遇到的程序开发问题。

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

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

原文地址:https://54852.com/web/1103109.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存