Skip to content

Instantly share code, notes, and snippets.

/**心跳动画*/
- (void)heartAnimationWithLayer:(CALayer*)layer {
CAAnimationGroup *group = [[CAAnimationGroup alloc]init];
group.duration = 0.5;
group.repeatCount = HUGE;
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAnim.toValue = @1.2;
CABasicAnimation *alphaAnim = [CABasicAnimation animationWithKeyPath:@"opacity"];
alphaAnim.toValue = @0.3f;
group.animations = @[scaleAnim,alphaAnim];
@ycditchf
ycditchf / funloop.m
Last active December 22, 2017 11:21
监测runloop
- (void)setupRunloopObserver
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
CFRunLoopRef runloop = CFRunLoopGetCurrent();
CFRunLoopObserverRef enterObserver;
enterObserver = CFRunLoopObserverCreate(CFAllocatorGetDefault(),
kCFRunLoopEntry | kCFRunLoopExit,
true,