CALayer – backgroundColor flipped?

 

Questions


I’m creating a CALayer like this:

UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"MyPattern.png"]];
backgroundLayer = [[CALayer alloc] init];
[backgroundLayer setBackgroundColor:[color CGColor]];
[[self layer] addSublayer:backgroundLayer];

For some reason, the pattern is drawn upside down. I’ve already tried setting geometryFlipped and applying sublayer transforms, but it doesn’t work.

 

 

————————————————-

Answer

Using [backgroundLayer setTransform:CATransform3DMakeScale(1.0, -1.0, 1.0)]; actually does work.

calayer,core-animation,iphone,objective-c

Facebook Comments

Post a comment