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.
Asked
Active
Viewed 1,117 times
1 Answers
4
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];

IronManGill
- 7,222
- 2
- 31
- 52
-
will this have the same transition as model view? – footyapps27 Oct 18 '12 at 10:09
-
1Sounds like a good idea but better to adjust the y instead of the height of the view frame, no? Example start with (0, -460, 320, 460) and transition to (0, 0, 320, 460) – ElasticThoughts Oct 18 '12 at 11:09
-
Yup you can do that too @CocoaNoob :) – IronManGill Oct 18 '12 at 11:20
-
yeah did that itself. Thanx a lot @Gill. – footyapps27 Oct 18 '12 at 13:00