我有一个视图,我更改应用程序更改状态的背景。基本上我希望视图背景更改在某种幻灯片中进行动画处理。我一直在寻找解决方案,但还没有真正找到任何东西。动画视图背景更改
所以我想从当前背景到下一个过渡。
//current to:
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
我没有问题让背景变化,但我想动画它。任何帮助正确的方向将不胜感激谢谢。
我有一个视图,我更改应用程序更改状态的背景。基本上我希望视图背景更改在某种幻灯片中进行动画处理。我一直在寻找解决方案,但还没有真正找到任何东西。动画视图背景更改
所以我想从当前背景到下一个过渡。
//current to:
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
我没有问题让背景变化,但我想动画它。任何帮助正确的方向将不胜感激谢谢。
只是一个简单的动画块:
[UIView animateWithDuration:time animations^{
self.view.backgroundColor = [UIColorWithPatternImage:image];
}];
这只是动画转移,服用时间秒。
您可以使用此:
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationOptionAutoreverse
animations:^
{
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
}
completion:nil
];
一个非常简单的方法来处理它:
如yourView.backgroundColor = [UIColor redColor];
然后用这个动画改变颜色
#import <QuartzCore/QuartzCore.h>
yourView.backgroundColor = [UIColor blueColor];
CATransition *transiton = [[CATransition alloc] init];
transiton.duration = .5;
[yourView.layer addAnimation:transiton forKey:@"Animation"];
创建'UIView'作为'self.view'的子视图,并为该视图做动画 – Venkat 2013-03-20 07:04:16
请求检查答案,并接受帮助你的答案 – 2013-03-20 08:28:01