我在视图控制器中添加一个视图(让我们说redView)self.view。addSubview一个视图 - 显示为PageCurlDown
现在的问题是我想要页面向下卷动动画时添加redView。
是否有可能得到那个?
我在视图控制器中添加一个视图(让我们说redView)self.view。addSubview一个视图 - 显示为PageCurlDown
现在的问题是我想要页面向下卷动动画时添加redView。
是否有可能得到那个?
萨姆帕斯,
我这样做是一个应用程序,我此刻的发展。
这是我做的,它工作正常:
[self.view insertSubview:redView atIndex:0]
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionCurlDown
animations:^{ [[[self.view subviews] objectAtIndex:1] removeFromSuperview];}
completion:NULL];
希望它为你工作。
Keith
非常感谢您的回答。请参阅第四条评论以上答案。 – Sampath 2012-02-09 05:21:29
如果redView是UIViewController的子类。
首先方法
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:redView.view
cache:YES];
[self.view addSubview:redView.view];
[UIView commitAnimations];
第二方法
RedView *viewController = [[RedView alloc] initWithNibName:@"RedView" bundle:nil];
[viewController setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:viewController animated:YES];
如果redView是的UIView的子类。
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:redView
cache:YES];
[self.view addSubview:redView];
[UIView commitAnimations];
这些对我来说似乎有些复杂,我认为begin动画和commit动画已经被弃用,以支持我在答案中使用的block动画。 – 2012-02-08 10:42:29
它没有折旧,它表示不鼓励ios 4日后 – Krrish 2012-02-08 10:45:39
公平的。我立场纠正。 – 2012-02-08 13:55:35
Google for * addSubview animated *,第一个结果是[this](http://stackoverflow.com/questions/2337408/addsubview-animation)。 – lawicko 2012-02-08 10:05:51
@lawicko:感谢您的链接。我想让redView在添加到self.view时进行curlDown。 – Sampath 2012-02-08 10:11:31