I'm using CATransition to slide subviews of UIView. But the problem is that the CATransition always appears in whole screen. And it looks like a mess because I have another UI elements in window that become overlapped while transitioning. How can I restrict frame of transition by UIView frame? I tried to set clipToBounds of my UIView to YES. Actually it doesn't help.
I'm not really 100% sure about this, but I think you're wrong about CATransition applying to the whole screen. It applies to the view you add the animation to.
The idea is that you apply the transition to the parent of the view you actually want to transition. So say you have the following structure.
What you need to do is add a "holding" or "container" view between the main UIViewController view and your actual targeted view, such that it looks like this:
Apply your transition to the container view and you'll be able to clip it, if you want. If it still goes out of bounds, then try turning on clipsToBounds on the containing view, or the layer's masksToBounds property
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With