Reputation: 239
Hi every one here is an image from my iphone simulator to show you my problem.(at left my layer at right an image) .I add a layer as a sublayer of an imageView and I would like to center my layer on my imageView but I don't know how to do it ? Can anyone help me ? sorry for my english I'm french :/
image from my iphone simulator
Upvotes: 0
Views: 347
Reputation: 3439
You're going to have to set the anchor point or position of the layer you added to the center of the bounds of the image. Something along the lines of
[boxLayer setPosition:CGPointMake([self bounds].size.width /2, [self bounds].size.height /2)];
Upvotes: 2