I\'d like to add a drop shadow to text drawn using the iOS supplied NSString (UIStringDrawing)
category method:
- (CGSize)drawAtPoint:(CGPoint)p
It works fine for me with CGContextSetShadow()
. Example:
- (void)drawRect:(CGRect)rect
{
NSString *string = @"Hello World!";
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetShadow(context, CGSizeMake(20.0f, 20.0f), 10.0f);
[string drawAtPoint:CGPointMake(100.0f, 100.0f) withFont:[UIFont boldSystemFontOfSize:36.0f]];
}