I have created a UIView subclass which contains a UIImageView subview. The UIIMageView subview may typically lie outside the bounds of its superview (my UIView subclass). This is not a problem, no clipping occurs as my subview does not 'clipsToBounds'. That is until my subview performs a transition animation.
[UIView transitionWithView:self
duration:0.7
options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowAnimatedContent
animations:^{
self.bodyView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
}
completion:^(BOOL fin){
}];
In this example 'bodyView' is the UIImageView subview of my UIView subclass. During the transition bodyView clips. I have tried setting the 'masksToBounds' property of the superview's layer to 'NO' but this has not solved the problem.
My only workaround at present is for the superview to be much larger than the subview and not allow the subview's frame to exist outside the superview's bounds but this is not practical in my application.
I've solved it. It was a problem of my own making I'm afraid. I referenced the wrong view in the transitionWithView:duration:options:animations:
-method. I should have referenced the view that was animating i.e. the subview. Code now works without clipping like so:
[UIView transitionWithView:self.bodyView
duration:0.7
options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowAnimatedContent
animations:^{
self.bodyView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
}
completion:^(BOOL fin){
}];