tags:

views:

40

answers:

2

Hi All,

I'm trying to draw an image to the screen in a UIView subclass I'm making.

It's all working perfectly expect for the fact that my image is coming out upside down.

I'm using the code...

CGFloat height = CGRectGetHeight(rect);
CGFloat width = CGRectGetWidth(rect);
UIImage *thumbImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"single_blue" ofType:@"png"]];
CGImageRef thumbImageRef = thumbImage.CGImage;
CGContextDrawImage(context, CGRectMake((width/10)*[mean doubleValue] - 13, -3, 26, 35), thumbImageRef);

Any ideas why it's coming out upside down?

Thanks for any help.

Oliver

::EDIT:: OK, so Safari looks like it's died. Chrome is working fine though. Very odd.

+2  A: 

The iPhone CoreGraphics coordinate system is flipped upside-down from that of the Mac. I often just vertically preflip all my images before adding them to my iPhone projects.

hotpaw2
Thanks! I'll be sure to do that in the future :D
Fogmeister