May 2011
Beginner
834 pages
25h 19m
English
To add a shadow to a drawing, give the context a shadow value before drawing. The shadow position is expressed as a CGSize, where the positive direction for both values indicates down and to the right. The blur value is an open-ended positive number; Apple doesn’t explain how the scale works, but experimentation shows that 12 is nice and blurry, 99 is so blurry as to be shapeless, and higher values become problematic.
Figure 15-9 shows the result of the same code that generated Figure 15-8, except that before we start drawing the arrow into the real context, we give the real context a shadow with this line:
CGContextSetShadow(con, CGSizeMake(7, 7), 12);

Figure 15-9. Drawing with a shadow
Read now
Unlock full access