Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a modal view?

I wanted to do bottom-up or up-bottom animation for settings page. (which would normally be pushViewController)
And found out that bottom-up can be done with..

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated;

Some people seem to suggest that you stick to Apple's HIG (Apple surely made left-right animation as default pushViewController) and do not use modal view.

I wonder what is modal view and wonder what other animations people use for pushing/popping viewController?

Thank you.

like image 827
eugene Avatar asked Mar 16 '11 15:03

eugene


1 Answers

A modal view prevents interaction with any other UI until it is dismissed.

A modal view controller is simply a UIViewController class that is presented modally. When the view controller is presented modally it covers whatever the existing view was (using an animation if specified) and the user most somehow dismiss this view before they can return to what they were doing.

To present a view controller in a modal fashion, you can use the method:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated;

Whenever I want to use a modal view (i.e. a view that must be completed before continuing with anything else) I would call this method and use Apple's standard animation for presenting a view controller (notice that the instance method above does not include a parameter to specify how the view is animated - because Apple has a standard way of doing this).

like image 60
James Bedford Avatar answered Oct 24 '22 16:10

James Bedford