Graphics Reference
In-Depth Information
The Apple convention is that user interface shadows point vertically downward, so on iOS
it's probably a good idea to use zero for the width and a positive value for the height in
most cases.
The shadowRadius property controls the blurriness of the shadow. A value of zero
creates a hard-edged shadow that exactly matches the shape of the view. A larger value
creates a soft-edged shadow that looks more natural. Apple's own app designs tend to use
soft shadows, so it's probably a good idea to stick with a nonzero value for this.
Generally, you should use a larger shadowRadius for something like a modal overlay
than you would to make a control stand out from its background; the blurrier the shadow,
the greater the illusion of depth (see Figure 4.6).
Figure 4.6 A larger shadow offset and radius increases the illusion of depth.
Shadow Clipping
Unlike the layer border, the layer's shadow derives from the exact shape of its contents, not
just the bounds and cornerRadius . To calculate the shape of the shadow, Core
Animation looks at the backing image (as well as the sublayers, if there are any) and uses
these to create a shadow that perfectly matches the shape of the layer (see Figure 4.7).
Search WWH ::




Custom Search