Gold Challenge: Shadows and Gradients

At this time, adding drop shadows and drawing with gradients can only be done using Core Graphics.

To create a drop shadow, you install a shadow on the graphics context. After that, anything opaque that you draw will have a drop shadow. The shadow has an offset (which is expressed with an CGSize), and a blur in points. Here is the declaration of the method used to install the shadow on the graphics context:

v​o​i​d​ ​C​G​C​o​n​t​e​x​t​S​e​t​S​h​a​d​o​w​ ​(​
 ​ ​ ​C​G​C​o​n​t​e​x​t​R​e​f​ ​c​o​n​t​e​x​t​,​
 ​ ​ ​C​G​S​i​z​e​ ​o​f​f​s​e​t​,​
 ​ ​ ​C​G​F​l​o​a​t​ ​b​l​u​r​)​;​

(There is a version that takes a color, but you almost always want a dark shadow.)

There is no unset shadow function. Thus, you ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.