对 Objective-C 中的文本应用阴影效果

Applying shadow effects to text in Objective-C

我是 Objective-C 编程新手。 如何以编程方式将阴影效果应用于 Objective-C 中的文本?

这是我的代码:

[label setText:@"Some Text Data"];
[label setShadowColor:[UIColor whiteColor]];
[label setTextAlignment:NSTextAlignmentLeft];  
[label setFont:[UIFont fontWithName:@"HelveticaLTStd-Roman" size:19]];  
[label setTextColor:[UIColor colorWithRed:24.0f/255.0f green:24.0f/255.0f blue:24.0f/255.0f alpha:1.0]];

试试这个。

[label setText:@"Downloading Data"];
[label setShadowColor:[UIColor whiteColor]];
label.layer.shadowOffset = CGSizeMake(0.0, 0.0);
label.layer.shadowRadius = 3.0;
label.layer.shadowOpacity = 0.5;
[label setTextAlignment:NSTextAlignmentLeft];
[label setFont:[UIFont fontWithName:@"HelveticaLTStd-Roman" size:19]];
[label setTextColor:[UIColor colorWithRed:24.0f/255.0f green:24.0f/255.0f blue:24.0f/255.0f alpha:1.0]];