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.

有帮助吗?

解决方案

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];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top