这个比较简单只需重写父类方法-(void)drawRect:(CGRect)rect;在该方法里写动画即可:
-(void)drawRect:(CGRect)rect {
[super drawRect:rect];
[[self backgroundColor] setFill]; //
UIRectFill(rect);
NSInteger pulsingCount = 3; // 波纹数
double animationDuration = 6; // 波纹扩散速度
CALayer * animationLayer = [CALayer layer];
for (int i = 0; i < pulsingCount; i++) {
// 创建波纹
CALayer * pulsingLayer = [CALayer layer];
pulsingLayer.frame = CGRectMake(0, 0, rect.size.width, rect.size.height);
pulsingLayer.cornerRadius = rect.size.height / 2.0;
pulsingLayer.borderColor = [UIColor whiteColor].CGColor;
pulsingLayer.borderWidth = 1;
&