CATransition replaceSubView:with…is animating all views
-
17-09-2020 - |
Question
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];
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow