views:

460

answers:

1

I have a UIViewController where I am adding a CALayer subclass to the view's layer:

[self.view.layer addSublayer:myObject.backgroundLayer];

When I rotate the device, the view rotates, but the CALayer doesn't. It sort of gets shunted off to the left, still in portrait view.

Is there a way to make sublayers rotate automatically or do I need to apply a transform?

A: 

You need to manage the rotation of the CALayer yourself. I believe that 0,0 stays at the same place and that the size is changed to match the new orientation, so if you wanted to do something yourself, you'd need to manage the addition of the rotation transformation yourself.

AlBlue