self.view.background を設定するための 3 つの画像があります。私がしようとしているのは、Twitter iOS APPログインUIのような背景を設定することです(5秒ごとにランダムに背景画像を変更します。)
すべてのランダムプロセスが完了しました。私が本当に困っているのは、UIAnimation を使用しているときに同期モードをランダム化することです。動作すると、UI 全体が期待どおりに UIAnimation プロセスを待機します。
これが私のコードです:(私はviewDidLoadメソッドの最後でこのメソッドを呼び出しています:
注:また、アルファの設定は機能していません..
-(void)startBackgroundImageChange
{
dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:5.0
delay:0.2
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:[self setBackgroundImage]]];
self.view.alpha = 1.0;
//here you may add any othe actions, but notice, that ALL of them will do in SINGLE step. so, we setting ONLY xx coordinate to move it horizantly first.
}
completion:^(BOOL finished){
//here any actions, thet must be done AFTER 1st animation is finished. If you whant to loop animations, call your function here.
self.view.alpha = 0.3;
[self startBackgroundImageChange];
}];
});
}
どんな助けでも大歓迎です..