在一个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 = [CATransition
animation
];
[animation
setType
:kCATransitionFade];
[animation
setSubtype
:kCATransitionFromTop];
[animation
setDelegate
:
self
];
[hearingAidHalo
setBackgroundImage
:[
UIImage
imageNamed
:
@
"m13_grayglow.png"
]
forState
:
UIControlStateNormal
];
[animation
setDuration
:2
.0
];
[animation
setValue
:
@
"Throb"
forKey
:
@
"MyAnimationType"
];
[[hearingAidHalo
layer
]
addAnimation
:animation
forKey
:
nil
];
- (
void
)animationDidStop:(CAAnimation *)theAnimation
finished
:(
BOOL
)flag{
NSString
* value = [theAnimation
valueForKey
:
@
"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 这个宏名字不太记得了。。。