开发者

Rotating an image problem

I'm trying to rotate an image by just touch and move.

Here is my code for rotating the view

[myView.layer setAnchorPoint:CGPointMake(1.0, 1.0)];

CODE INSIDE touchMoved

CGPoint Location = [[touches anyObject] locationInView:self.view];

Float32 Angle = (atan2(Location.x - myView.layer.center.x, Location.y - myView.layer.center.y));

myView.layer.transform = CGAffineTransformMakeRotation(-Angle);

Now everything works fine except one

If I rotate from the middle of the view then all work fine but when I try to rotate it from corners the it jumps and make my touch point as center (remember i have made lower 开发者_StackOverflow社区right side corner of the view fixed, see the anchor point). I just have to rotate the view up to 90 degree but only using single finger touch... I'm not sure if I was able to describe my problem correctly but problem


just put the code from the following link as it :Rotate the image on the same center

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜