CAAnimation相关

来源:互联网 发布:jsp引入js文件 编辑:程序博客网 时间:2024/06/06 03:40

在一个delegate函数里面区分不同的caanimation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
CATransition *animation = [CATransitionanimation];
[animation setType:kCATransitionFade];
[animation setSubtype:kCATransitionFromTop];
[animation setDelegate:self];
[hearingAidHalosetBackgroundImage:[UIImageimageNamed:@"m13_grayglow.png"]forState:UIControlStateNormal];
[animation setDuration:2.0];
[animation setValue:@"Throb"forKey:@"MyAnimationType"];
[[hearingAidHalolayer] addAnimation:animation forKey:nil];
 
- (void)animationDidStop:(CAAnimation *)theAnimationfinished:(BOOL)flag{
 
    NSString* value = [theAnimationvalueForKey:@"MyAnimationType"];
    if([value isEqualToString:@"Throb"])
    {
       //... Your code here ...
       return;
    }
 
    if([value isEqualToString:@"Special1"])
    {
       //... Your code here ...
       return;
    }
 
    //Add any future keyed animation operations when the animations are stopped.
}

 2.CAAnimationGroup 

Important: The delegate and removedOnCompletion properties of animations in the animations array are currently ignored. The CAAnimationGroup delegate does receive these messages.

3.要让一个ca动画终止后,保留末状态,在设置removedOnCompletion = NO后,还得设置fillMode = kCA…..Forward 这个宏名字不太记得了。。。

0 0
原创粉丝点击