如何在iphone SDK中将视图中的动画添加到另一个视图中

时间:2011-08-03 07:01:30

标签: iphone

我是iphone的新手。我正在开发一个应用程序,我想将视图添加到另一个视图中,但它会显示动画,有些人可以帮助我做到这一点。

2 个答案:

答案 0 :(得分:1)

试试这个,希望它能运作......

[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];

答案 1 :(得分:0)

更简单,使用presentModalViewController。这是一个例子:

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

不要忘记将第二个视图控制器的标题添加到第一个视图控制器的.h文件