我想在我的iOS应用程序中加载视图后为背景设置动画。这适用于纯色,但我无法让它使用背景图像。这是我的代码:iOS中的动画背景
- (void)viewDidLoad
{
[super viewDidLoad];
[UIView animateWithDuration:5.0 animations:^{
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background_dark.png"]];
}];
[UIView commitAnimations];
}
有没有人知道正确的方法来做到这一点?
谢谢
事实上,老式的动画有时会泄漏CGContextRef的内存 – 2013-04-24 16:53:05
在我的情况下,我试图改变背景颜色多次,由于用户滚动,但它只适用于第一次然后它改变背景没有动画,什么可以是原因吗? – 2014-04-20 20:41:23