Drop shadow coordinate different from iPhone OS 3.2?

Posted by Axel on Stack Overflow See other posts from Stack Overflow or by Axel
Published on 2010-05-29T17:45:46Z Indexed on 2010/05/29 17:52 UTC
Read the original article Hit count: 354

Filed under:
|
|
|

I'm trying to draw a custom view with a drop shadow. I'm having different results from iPhone OS 3.2. Has the coordinate system changed for CGContextSetShadowWithColor from 3.2?

Here is the code I'm using:

CGContextRef    graphicContext = UIGraphicsGetCurrentContext();

CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGFloat values1[4] = { 0, 0, 0, 1};
CGColorRef blackColor = CGColorCreate (colorspace, values1);
CGContextSetShadowWithColor(graphicContext, CGSizeMake(0, -1), 3, blackColor);
CGColorRelease(blackColor);

CGFloat values2[4] = { .5, .5, 1, 1};
CGColorRef fillColor = CGColorCreate (colorspace, values2);
CGContextSetFillColorWithColor(graphicContext, fillColor);
CGColorRelease(fillColor);
CGContextFillRect(graphicContext,CGRectMake(40, 40, 100, 100));

Here is how it looks on 3.1 and from 3.2.

All my views using drop shadow look different depending on the version of iPhone OS. Am I missing something?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview