iPhone UILabel text soft shadow

前端 未结 15 938
时光取名叫无心
时光取名叫无心 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:12

    _nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    _nameLabel.font = [UIFont boldSystemFontOfSize:19.0f];
    _nameLabel.textColor = [UIColor whiteColor];
    _nameLabel.backgroundColor = [UIColor clearColor];
    _nameLabel.shadowColor = [UIColor colorWithWhite:0 alpha:0.2];
    _nameLabel.shadowOffset = CGSizeMake(0, 1);
    

    i think you should use the [UIColor colorWithWhite:0 alpha:0.2] to set the alpha value.

提交回复
热议问题