Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

presentModalViewController detecting animation completion

I noticed iOS 5 introduced extra parameters and ways to detect when a view controller's presentation animation is complete.

Is there any way to do this in earlier versions, such as iOS 4.x?

I have used presentModalViewController to present the controller and I noticed that you can't call the dismiss method unless the animation has completed.

So how can I detect when the animation is complete so I can then dismiss it?

like image 830
blissweb Avatar asked Feb 24 '26 16:02

blissweb


1 Answers

I just tried dismissing a modally presented VC, on viewDidLoad, viewWillAppear and viewDidAppear. No dice on the first two, but the dismiss works in viewDidAppear. (Kind of makes sense that that would get called after the animations are done).

And, you probably know this already, but in case you don't: you don't have to dismiss the modally presented VC from the VC that presented it. Your "wait for the network" VC can check the connection state in viewDidAppear, and dismiss itself if the connection is finished.

like image 145
danh Avatar answered Feb 26 '26 09:02

danh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!