IPhone Text Glow Effect

前端 未结 6 2133
借酒劲吻你
借酒劲吻你 2020-11-30 03:22

In my IPhone application, I want the text in UILabel to glow for a second, then fade for a sec;. Also i want to repeat this cycle for say 3 or 4 times.

Is this poss

6条回答
  •  春和景丽
    2020-11-30 04:08

    - (UILabel *) setUpGlowLabelWithFrame: (CGRect) frame fontSize: (int)fontSize {
            UILabel* label = [[UILabel alloc] initWithFrame:frame];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont boldSystemFontOfSize:fontSize];
            label.textColor = [UIColor whiteColor];
            label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
            label.textAlignment = UITextAlignmentCenter;
            label.layer.shadowColor = [label.textColor CGColor];
            label.layer.shadowOffset = CGSizeMake(0.0, 0.0);
            label.layer.masksToBounds = NO;
    
        label.layer.shadowRadius = 0.5f;
        label.layer.shadowOpacity = 0.95;
        label.numberOfLines = 2;
        label.tag = 20;
    
        return label;
    }
    

    I get the glow effect when using this.

    Hope it helps.

    Happy coding :)

提交回复
热议问题