I'd like to know how to implement the blue ball with the pulsating ring of current location in maps, but without a mapview.
Basically I'd like to know the best way to have a blue ball with a pulsating ring on a normal UIView (or my custom view) whenever the user touches the screen, with that touch being the center of the blue ball.
I have 2 ideas, first I could implement an animation, which I was not able to do, but it is probably possible. Second I could get a sequence of images, like a gif, and display it wherever the user touches.
Which one is the best option? Or is there a better option?
Thank you.
Try this:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 100, 100)];
view.backgroundColor = [UIColor blueColor];
view.layer.cornerRadius = 50;
[self.view addSubview:view];
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.duration = 0.2;
scaleAnimation.repeatCount = HUGE_VAL;
scaleAnimation.autoreverses = YES;
scaleAnimation.fromValue = [NSNumber numberWithFloat:1.2];
scaleAnimation.toValue = [NSNumber numberWithFloat:0.8];
[view.layer addAnimation:scaleAnimation forKey:@"scale"];
Set the parameters as you like, to modify the effect.
Edit:
You have to add the QuartzCore
framework, and include <QuartzCore/QuartzCore.h>
for this to work.