1

アプリケーションの状態が変化すると、背景を変更するビューがあります。基本的に、ビューの背景の変更を何らかのスライドでアニメーション化したいと考えています。私は解決策を探していましたが、実際には何も見つかりませんでした。

ですから、現在の背景が何であれ、次の背景への移行が必要です。

//current to:
self.view.backgroundColor = [UIColor colorWithPatternImage:image];

背景を変更しても問題ありませんが、アニメーション化したいと思います。正しい方向への助けをいただければ幸いです。

4

3 に答える 3

2

これを使用できます:

[UIView animateWithDuration:1 
delay:0 
options:UIViewAnimationOptionAutoreverse                
animations:^
{
    self.view.backgroundColor = [UIColor colorWithPatternImage:image];
}
completion:nil 
];
于 2013-03-20T07:21:11.843 に答える
1

それを処理する非常に簡単な方法:

そのような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"];
于 2013-03-20T07:28:21.887 に答える
0

単純なアニメーション ブロック:

[UIView animateWithDuration:time animations^{
    self.view.backgroundColor = [UIColorWithPatternImage:image];
}];

これは転送をアニメーション化するだけで、時間は数秒かかります。

于 2013-03-20T07:04:27.150 に答える