gpt4 book ai didi

cocoa - CATransition 替换 subview :with…is animating all views

转载 作者:行者123 更新时间:2023-12-03 17:26:33 25 4
gpt4 key购买 nike

我怎样才能做到这一点,以便我的所有 View 的 subview 都不会在这里进行动画处理,而只有 currentPage 的representedView 和 newPage 的represented view ?

CATransition *transition = [CATransition animation];
[transition setType:kCATransitionPush];
[transition setSubtype:([self indexOfPage:currentPage] < [self indexOfPage:newPage]) ? kCATransitionFromRight : kCATransitionFromLeft];


NSDictionary *ani = [NSDictionary dictionaryWithObject:transition
forKey:@"subviews"];
[self setAnimations:ani];
[self.animator replaceSubview:currentPage.representedView with:newPage.representedView];

最佳答案

首先,当这正是您为其创建动画的属性时,您要求不对 subview 设置动画似乎很奇怪,因此我不太清楚您要做什么。

其次,动画的默认行为是为 View 及其所有 subview 设置动画。如果您只想为父 View 和特定 subview 设置动画,则不应将不想设置动画的 View 添加为 subview ,而应使用正确的 z 顺序使它们成为同级 View 。

关于cocoa - CATransition 替换 subview :with…is animating all views,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3274829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com