footyapps27
footyapps27

Reputation: 4042

Transition of Modal View in ios

Modal view in iOS appears from bottom of the screen to top, and dismisses from top to bottom of the screen. I would like to know, is there any way i can revert the above and make the model view appear from top of the screen to bottom of it. Thus when it is dismissed it will animate from bottom to top.

Upvotes: 0

Views: 1121

Answers (1)

IronManGill
IronManGill

Reputation: 7226

Yes why not I think I can offer you a workaround :) .... First Make a custom UIView and set its coordinates as

View.frame=CGRectMake(0, 0, 320, 0);

Then use Animations to move it from top to bottom and vice-versa like this:-

For making it appear use the following code:-

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.25];
View.frame = CGRectMake(0, 0, 320, 460);
[UIView commitAnimations];

For dismissing it use :-

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.25];
View.frame = CGRectMake(0, 0, 320, 0);
[UIView commitAnimations];

Upvotes: 4

Related Questions