开发者

How to add animation in view onto another view in iphone SDK

i am new in iphone. I developing an application and i want to add a view into another view but it will sh开发者_Python百科ow down to up with animation, some one help me to do that.


Try this, hope it'll work...

[self.view addSubview:yourView];
[yourView setFrame:CGRectMake(0, 460, 320, 460)];
[yourView setBounds:CGRectMake(0, 0, 320, 460)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationDelegate:self];
[yourView setFrame:CGRectMake(0, 460, 320, 460)];
[UIView commitAnimations];
[self.view addSubview:yourView];


Even easier, use presentModalViewController. Here's an example:

SecondViewController *aSecondViewController = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
aSecondViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:aSecondViewController animated:YES];

Just don't forget to add the header to your SecondViewController to the first view controller's .h file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜