I ran into the same problem and was able to solve it.
The custom transition API is not well documented and requires a lot of trial and error so that I can fix it.
Let me tell you how I was able to get it working without memory problems:
Here are the players:
VCA = view controller that wants to introduce VCB modally
VCB = Modified View Controller (represented by VCA)
TC = Custom transition controller object that performs custom animation.
A subclass of NSObject that matches "UIViewControllerAnimatedTransitioning".
An instance will be created inside TD.
TD = Custom transition delegate object that the transition controller provides to the system. A subclass of NSObject that matches "UIViewControllerTransitioningDelegate"
Now imagine a VCB instance
self = VCA instance
myModalViewController = is a strong self property
self.myModalViewController = [[VCB alloc] init]; [self.myModalViewController setModalPresentationStyle: UIModalPresentationCustom]; [self.myModalViewController setTransitioningDelegate: [[TD alloc] init]]; [self presentViewController: self.myModalViewController animated:YES completion:NULL];
At some point later, the VCB asks to reject the VCA
self = VCA instance
myModalViewController = VCB Instance Presented Above
[self dismissViewControllerAnimated:YES completion:^{ [self.myModalViewController setTransitioningDelegate: nil]; // DO THIS!!!! self.myModalViewController = nil; }];
Hope this helps. This is definitely for me.
tiescher
source share