0

I need to do a custom presentation animation and when i set both these setTransitioningDelegate and modalPresentationStyle=UIModalPresentationCustom

The animation is perfect with unless the viewDidAppear and viewDidDisappear is not called in the presenting viewcontroller.This is same for Apple sample code in https://developer.apple.com/library/ios/samplecode/LookInside/Introduction/Intro.html

[overlay setTransitioningDelegate:[self transitioningDelegate]];  
overlay.modalPresentationStyle=UIModalPresentationCustom;  
[self presentViewController:overlay animated:YES completion:NULL];

Why the methods are called when no modalPresentationStyle is given?

guhan0
  • 666
  • 6
  • 19

1 Answers1

3

This is the correct behaviour as presenting a new view controller only hides the presenting view controller. It doesn't add the view to the hierarchy when the presented view controller is dismissed, and it doesn't remove the presenting view controller view from the hierarchy when the view controller that is presented is presented.

Short story; it hides the view of the presenting view controller instead of removing it. Therefore the methods aren't invoked.

Snusmumrikken
  • 300
  • 1
  • 9
  • got.it.so i got some logic at view life cycle methods.so only way is to move them? and why the methods are called when no modalPresentationStyle is given? – guhan0 Dec 29 '15 at 19:18
  • Couldn't you create a delegate and invoke the delegate methods at the appropriate time according to your logic from the view controller that is presented? – Snusmumrikken Dec 29 '15 at 19:39
  • 1
    Here is another question that is similiar to yours: http://stackoverflow.com/questions/9621346/viewdiddisappear-not-called-when-use-presentviewcontroller?rq=1 – Snusmumrikken Dec 29 '15 at 19:39