Technical Q&A QA1706

Why are my shadows drawn upside down in iOS 3.2 and later?

Q:  Why are shadows in my app rendered upside down?

A: Beginning in iOS 3.2 the base coordinate space for CGContexts was changed to match the normal rendering (user) coordinate space of top-left instead of bottom-left. Shadows and Patterns drawn using the Quartz APIs use the base coordinate space, so they are affected by this change. Apps linked before iOS 3.2 will still get the old incorrect behavior, even when running on iOS 3.2 or later iOS versions. In order to support iOS 3.1.x or earlier iOSes, you will need to check the OS version and adjust the shadow offsets accordingly.

In iOS 3.1.3 and earlier shadows offsets have the following characteristics:

In iOS 3.2 and later shadows offsets have the following characteristics:



Document Revision History


DateNotes
2010-08-31

New document that describes the change in shadow behavior in iOS 3.2 and later