IPhone Text Glow Effect

前端 未结 6 2146
借酒劲吻你
借酒劲吻你 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:06

    As of 3.2 you there is direct support for shadows in the SDK.

    label.layer.shadowColor = [label.textColor CGColor];
    label.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    

    Play with the parameters:

    label.layer.shadowRadius = 3.0;
    label.layer.shadowOpacity = 0.5;
    

    And to avoid shadow being clipped by the label bouds:

    label.layer.masksToBounds = NO;
    

    Don't forget to

    #include 
    

    and link against the QuartzCore or CoreGraphics frameworks (thanks to commenters for pointing this out).

提交回复
热议问题