2010-08-26 80 views
1

我想绘制一个图像到我制作的UIView子类中的屏幕。iphone png文件倒过来

对于我的图像颠倒过来的事实,这一切都是完美的预期。

我正在使用的代码...

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); 

任何想法,为什么它的到来了倒挂?

感谢您的任何帮助。

Oliver

::编辑:好吧,所以Safari看起来就像死了。 Chrome虽然工作正常。很奇怪。

+0

http://stackoverflow.com/questions/506622/cgcontextdrawimage-draws-image-upside-down-when-passed-uiimage-cgimage 看到这里的修复。 Safari死了,打破了堆栈溢出,所以我无法搜索。现在所有更好,但发现这一点:D – Fogmeister 2010-08-26 22:28:06

回答

2

iPhone CoreGraphics坐标系与Mac翻转倒置。 我经常只是在将所有图像添加到我的iPhone项目之前垂直预先翻转所有图像。

+0

谢谢!我将来一定会这样做:D – Fogmeister 2010-08-26 22:46:41