Why my image is up side down?

Posted by Tattat on Stack Overflow See other posts from Stack Overflow or by Tattat
Published on 2010-05-04T12:58:41Z Indexed on 2010/05/04 13:48 UTC
Read the original article Hit count: 218

Filed under:
|

This is my drawInContext method:

UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"png"]];
CGRect cropRect = CGRectMake(0, 0, 175, 175);
CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect);

CGRect imageRect;

imageRect.origin = CGPointMake(0, 0);
imageRect.size = CGSizeMake(175, 175);

CGContextDrawImage(UIGraphicsGetCurrentContext(), imageRect, imageRef);
CGImageRelease(imageRef);

My image is upside down, how can I change it? What's wrong with my code? How can I change the image become normal?? thx .

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about image