使用NSShadow來設(shè)置陰影屬性
NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowBlurRadius = 2;//陰影半徑皆辽,默認(rèn)值3
shadow.shadowColor = [UIColor blackColor];//陰影顏色
shadow.shadowOffset = CGSizeMake(0,2);//陰影偏移量驱闷,x向右偏移,y向下偏移空另,默認(rèn)是(0,-3)
NSAttributedString * attributedText = [[NSAttributedString alloc] initWithString:@"test" attributes:@{NSShadowAttributeName:shadow}];
最后將富文本attributedText賦值給label就ok了