0

我已成功使用 colorWithPatternImage 在用于演示背景的 CALayer 中创建背景颜色。但是,图像以颠倒的颜色呈现。我从数小时的阅读帖子和文档中了解到,这是因为屏幕坐标相反。

因此,我尝试了在阅读帖子数小时后发现的这段代码,但它不起作用。

下面使用的 pImage 是之前从 NSURLConnection 加载的。

flippedImage = [UIImage imageWithCGImage:pImage.CGImage scale: 1.0f orientation: UIImageOrientationDownMirrored];

self.backgroundColor = [UIColor colorWithPatternImage:flippedImage].CGColor;

self.anchorPoint = CGPointMake(0.0,0.0);

我应该说我是在后台线程中执行此操作的。我还尝试了文档中的其他方向,但它们都不适用于我的代码。

谢谢你

4

1 回答 1

0

翻转图层!?将 geometryFlipped 设置为 YES

于 2012-11-10T19:34:55.353 回答