Nick Harris

CGContextSetShadow in iOS4

with one comment

What am I doing wrong? This code…

CGContextSetShadow(context, CGSizeMake(1, -2), 3.0);
[userImage drawInRect:CGRectIntegral(rUserImage) blendMode:kCGBlendModeNormal alpha:1.0];
CGContextRestoreGState(context);

Creates this (the top image) in iPhone OS 3.1.3…

… and this on iOS 4…

Notice the drop shadows are opposite. The bottom cells I corrected for iOS4 but as you can see in 3.1 they’re wrong.

Advertisements

Written by Nick Harris

June 25, 2010 at 5:29 pm

Posted in Uncategorized

One Response

Subscribe to comments with RSS.

  1. The quartz coordinate space is flipped in iOS 4 to match the rest of UIKit coordinate space, so flipped Y.

    The only way I’ve seen to deal with this is check for the OS version and adjust appropriately.

    Joe

    July 15, 2010 at 1:09 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: