IPHONEフェード、フェードアウトのUIImageViewの異なる倍
-
21-09-2019 - |
質問
をしたいと思っているフェードのUIImageViewの使用、ということかを以下のパラメータ:
- t=0...UIImageViewのアルファ=0
- t=0.5s...UIImageViewのアルファ=0.7
- t=0.7s...UIImageViewのアルファ=0
こんなことが可能なのでいCAAnimationまたはその他の方法は?どのようにとすることはできますか。
させます。
解決
きょうCAKeyframeAnimation.まだ設定値を複数の時点です。
他のヒント
if (imgDefault.alpha == 0.0) {
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration: 3.0];
[UIView setAnimationDelegate: self];
imgDefault.alpha = 1.0;
[UIView commitAnimations];
}
else {
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration: 3.0];
[UIView setAnimationDelegate: self];
imgDefault.alpha = 0.0;
[UIView commitAnimations];
}
希望します
UIViewはsetAnimationDidStopSelector:方法でご利用いただけます。単なる設定のごフェードアニメーションを使用しbeginAnimationsブロックの設定を行didStopセレクター別の方法を含み、フェードアウトアニメブロックです。それぞれのアニメブロックでアニメ間.
のようなこと:
[UIView beginAnimations:next context:context];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(fadeOut:finished:context:)];
myView.alpha = 0.7;
[UIView commitAnimations];
-(void)fadeOut:(NSString*)animationID finished:(BOOL)finished context:(void*)context {
[UIView beginAnimations:nil context:context];
[UIView setAnimationDuration:0.2];
myView.alpha = 0.0;
[UIView commitAnimations];
}
所属していません StackOverflow