iPhone UILabel text soft shadow

前端 未结 15 936
时光取名叫无心
时光取名叫无心 2020-12-07 09:31

I know soft shadows are not supported by the UILabel out of the box, on the iPhone. So what would be the best way to implement my own one?

EDIT:

15条回答
  •  温柔的废话
    2020-12-07 10:22

    This like a trick,

    UILabel *customLabel = [[UILabel alloc] init];
    
    UIColor *color = [UIColor blueColor];
    customLabel.layer.shadowColor = [color CGColor];
    customLabel.layer.shadowRadius = 5.0f;
    customLabel.layer.shadowOpacity = 1;
    customLabel.layer.shadowOffset = CGSizeZero;
    customLabel.layer.masksToBounds = NO;
    

提交回复
热议问题