大家好;
我不确定发生了什么变化以阻止它起作用。在 iOS 3 SDK 上,以下代码在 CATiledLayer 类中运行良好:
- (void)drawInContext:(CGContextRef)context {
UIImage* image = [[ResourcesManager sharedResourcesManager] getUIImageFromArray:Image_Cell_Background Index:[mazeCell zone]];
UIColor* color = [[UIColor alloc] initWithPatternImage:image];
[self setBackgroundColor:[color CGColor]];
[color release];
但是,为 iOS 4 编译并在模拟器上执行无法渲染图像。我很困惑,特别是因为作为子层添加的图像渲染得很好。只有背景不渲染。