According to the documentation, you do it by creating an animation with an extremely large repeatCount
(code excerpted from the documentation I linked to):
// create the animation that will handle the pulsing.
CABasicAnimation* pulseAnimation = [CABasicAnimation animation];
// over a one second duration, and run an infinite
// number of times
pulseAnimation.duration = 1.0;
pulseAnimation.repeatCount = 1e100f;
// we want it to fade on, and fade off, so it needs to
// automatically autoreverse.. this causes the intensity
// input to go from 0 to 1 to 0
pulseAnimation.autoreverses = YES;
edit: The OP asked how to stop the animation. From the next paragraph in the documentation:
You start an explicit animation by
sending a addAnimation:forKey:
message
to the target layer, passing the
animation and an identifier as
parameters. Once added to the target
layer the explicit animation will run
until the animation completes, or it
is removed from the layer. The
identifier used to add an animation to
a layer is also used to stop it by
invoking removeAnimationForKey:
. You
can stop all animations for a layer by
sending the layer a
removeAllAnimations
message.