如何在过渡动画期间设置页面卷曲底部背景颜色/图像?

时间:2012-03-19 00:20:27

标签: iphone objective-c ios animation uiview

我正在使用UIViewAnimationOptionTransitionCurlUp过渡动画在我的应用程序中的视图之间进行转换。然而,页面卷曲底部的标准白色背景在我的应用程序中看起来很难看。如何更改“页面”背面的背景颜色(或图像)?

我在这两页上发布的建议没有成功:

How do I control the background color during the iPhone flip view animation transition?

http://adrianhosey.blogspot.com/2009/04/putting-background-behind-uiview.html

根据上述链接帖子中的建议,我尝试将以下代码添加到viewDidLoad:,同时在我的视图和窗口中添加子视图,但这也不起作用:

UIView *dummyView = [[UIView alloc] initWithFrame:self.view.window.frame];
dummyView.backgroundColor = [UIColor blueColor];
[self.view addSubview:dummyView];
[self.view.window addSubview:dummyView];

作为参考,这是我的动画代码:

[UIView transitionWithView:self.view
                  duration:0.75
                   options:UIViewAnimationOptionTransitionCurlUp|UIViewAnimationCurveEaseIn
                animations:^{}
                completion:^ (BOOL success){
                   // do some stuff here
                }];

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

将此代码用于动画卷曲.....

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.80];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp 
                       forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:self.detailviewcontyrollerObj animated:YES];
[UIView commitAnimations];

希望这有助于......:)