I have a custom transition to animation on my view controller when I invoke animation using an interactive delegate attached to the animation. When I add an interactive component that works correctly. However, when I received the button to reject, as I had before I had the interactive component, the animation completion block will not be called.
Below is an animation block. At first, I used a variation of the delay / options of the animation block and changed it to a simpler animation / completion to make sure that this is not a function. If I remove all the code from the animation block, it will execute and kill the controller (albeit without animation). I do not know what kind of cold is mistaken and cannot find a similar problem.
The gesture simply pushes the finger to the right to reject the modality ... it works great. When I delete the interactive part, the animation works fine when the button is clicked. This only happens when I attach an interactive component to the view controller.
Here is the animation block:
[UIView animateWithDuration:PRESENT_DURATION animations:^{
CGAffineTransform newTransform = fromViewController.view.transform;
newTransform = CGAffineTransformTranslate(transform, adjustedBounds.size.width, height);
fromViewController.view.transform = newTransform;
toViewController.view.alpha = 1;
} completion:^(BOOL finished){
NSLog(@"Finished Animation");
if ([transitionContext transitionWasCancelled]) {
[transitionContext completeTransition:NO];
} else {
[fromViewController.view removeFromSuperview];
[transitionContext completeTransition:YES];
}
}];
Here I am attaching an animation and interacting controller to the ViewController
- (IBAction)settingsButtonClicked:(id)sender
{
UINavigationController *navigationController =[[self storyboard] instantiateViewControllerWithIdentifier:@"SettingsNavigationViewController"];
navigationController.modalPresentationStyle = UIModalPresentationCustom;
navigationController.transitioningDelegate = self;
navigationController.edgesForExtendedLayout = UIRectEdgeNone;
[self presentViewController:navigationController animated:YES completion:^{
id animator = [navigationController.transitioningDelegate animationControllerForDismissedController:self];
id interactor = [navigationController.transitioningDelegate interactionControllerForDismissal:animator];
if ([interactor respondsToSelector:@selector(attachToViewController:)]) {
[interactor attachToViewController:self];
}
}];
navigationController.view.superview.frame = CGRectMake(0, 0, navigationController.view.frame.size.width, self.view.frame.size.height);
}
source
share