In my viewDidLoad I have this code which sets up some drawing on a CALayer:

rootLayer = [CALayer layer];

rootLayer.frame = CGRectMake(164, 243, 30, 30);

[self.view.layer addSublayer:rootLayer];


It's positioned properly. Now, I'd like to have it rotate around it's
"registration" point. Adding a background color to the layer I can see that
my drawing uses the top left corner of the layer.

I have this method with only works correctly for portrait, for the others
all i want to do is see it rotate 90ยบ and then I can figure the rest out.
This is rotating the layer but on device rotation, the whole layer is
shifting around. I'd like to lock it down to the original corner:

-
(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {

    if(toInterfaceOrientation == UIInterfaceOrientationPortrait){

        rootLayer.transform = CATransform3DMakeRotation(0.0, 0.0, 0.0, 0.0);

    } else {

        rootLayer.transform = CATransform3DMakeRotation(90.0/180 * M_PI,
0.0, 0.0, 0.0);//rotates but moves down to the left

    }

}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to