2010-04-23 98 views
0

自现在起5小时,我正在尝试:如何在-drawRect中绘制UIImageView:?

- (void)drawRect:(CGRect)rect { 
    // flip the wrong coordinate system 
    CGContextTranslateCTM(context, 0.0f, rect.size.height); //shift the origin up 
    CGContextScaleCTM(context, 1.0f, -1.0f); //flip the y-axis 

    CGContextDrawImage(context, myImgView.frame, myImageView.image.CGImage); 
} 

的问题:当图像绘制正确,在框架的UIImageView指定的坐标是完全无用的。图像显示在屏幕上完全错误。

我想我还必须翻转UIImageView的CGRect?但是如何?

回答