Adding glow effect to UIButton - iOS

后端 未结 6 1999
一生所求
一生所求 2020-12-04 22:25

I have an UIButton which is a logo. This logo button will glow on forever but will stop glowing on touch.It is like a glowing animation.

Is there any suggestions?

6条回答
  •  旧巷少年郎
    2020-12-04 23:17

    I like this glow + grow/shrink animation for my 'extra special' buttons:

    -(void)makeViewShine:(UIView*) view
    {
    view.layer.shadowColor = [UIColor yellowColor].CGColor;
    view.layer.shadowRadius = 10.0f;
    view.layer.shadowOpacity = 1.0f;
    view.layer.shadowOffset = CGSizeZero;
    
    
    [UIView animateWithDuration:0.7f delay:0 options:UIViewAnimationOptionAutoreverse | UIViewAnimationCurveEaseInOut | UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction  animations:^{
    
        [UIView setAnimationRepeatCount:15];
    
        view.transform = CGAffineTransformMakeScale(1.2f, 1.2f);
    
    
    } completion:^(BOOL finished) {
    
        view.layer.shadowRadius = 0.0f;
        view.transform = CGAffineTransformMakeScale(1.0f, 1.0f);
    }];
    
    }
    

提交回复
热议问题