質問

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