Reputation: 2562
I need to draw an effect like this on a UILabel.
How can I do it?
Upvotes: 2
Views: 781
Reputation: 4022
U can try the below code. U can change the color of the text or the shadow based on the color of the background.
[label setShadowColor:[UIColor darkGrayColor]];
[label setShadowOffset:CGSizeMake(0, -1)];
Upvotes: 1
Reputation: 4684
If you're on gray background, I usually just use UILabel's text shadow property positioned one pixel below with color white. That comes quite close. If you really need more (i.e. if you want to have the dark edges above, then you need to write a custom label that draws the text multiple times). CoreGraphics can help you a bit with the CGContextSetShadow, though.
Upvotes: 0