Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between presentModalViewController and presentViewController?

Tags:

In iOS 5 SDK, there're two methods of UIViewController, presentModalViewController:animated: and presentViewController:animated:completion:.

What's the difference between these two method?

The documentation says: The presentViewController:animated:completion: method is the preferred way to present a modal view as of iOS 5.0.

If I use a presentModalViewController:animated in iOS 5, will it causes a bug?

Are they functionally-same?

like image 500
YuAo Avatar asked Dec 03 '11 03:12

YuAo


1 Answers

They seem to do the same thing as apple documentation points out, as of iOS 5.0 presentViewController is the preferred way to present view controllers, it seems that presentViewController now lets you have a completion handler, whereas before you did not have that.

And no the older presentModalViewController should be fine on iOS 5.0, if it caused a bug that would be a problem for all the older apps and would not be very backward compatible. Furthermore it seems that now with presentViewController you can get a lot more info about the viewController hierarchy as we have presentingViewController, presentedViewController properties.

like image 174
Daniel Avatar answered Oct 21 '22 10:10

Daniel