CATransition ReplaceSubView:with…正在对所有视图进行动画处理
我怎样才能做到这一点,以便我的所有视图的子视图都不会在这里进行动画处理,而只有 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];
how can I make it so all of my view's subviews aren't animated here and only the currentPage's representedView and the newPage's represented view's?
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,当这正是您为其创建动画的属性时,您要求不对子视图设置动画似乎很奇怪,因此我不太清楚您要做什么。
其次,动画的默认行为是对视图及其所有子视图进行动画处理。如果您只想为父视图和特定子视图设置动画,则不应将不想设置动画的视图添加为子视图,而应使用正确的 z 顺序使它们成为同级视图。
First, it seems odd that you are requesting to not animate subviews when this is the exact property you created your animation for so I'm not real clear on what you're trying to do.
Second, the default behavior for animation it to animate the view and all of its subviews. If you want to only animate the parent view and specific subviews, you should not add the views you don't want to animate as children of it, but rather make them siblings with the proper z order.