2010-08-26 34 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