iPad アプリケーションで画像を (たとえば時計回りに) 回転させる必要があります。画像はビュー内に保持されます。
UIImageView *view1 = [[UIImageView alloc] initWithFrame:CGRectMake(startX+lineWidth, startY+lineHeight, lineWidth, lineHeight)];
view1.tag = 0;
view1.image = [UIImage imageNamed:[images objectAtIndex:0]];
の
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
私はこれをやっています:
CGPoint d1 = [touch locationInView:touch.view];
CGPoint d2 = [touch previousLocationInView:touch.view];
CGFloat angle1 = atan2(d1.y, d1.x);
CGFloat angle2 = atan2(d2.y, d2.x);
subview.transform = CGAffineTransformRotate(subview.transform, angle2-angle1);
ビューは回転していますが、タッチ(または私の開発環境ではカーソル)とスムーズに連動しません。むしろ、タッチよりも少し前に浮かんでいます。
私は何が欠けていますか?