こんにちは
touchesbeganから x& y 値を取得する方法は、私たちの方法で、TextField の場所を取得するためにこのようなサンプルを作成しました。この場所は、テキストの場所を計算し、UIImage にテキストを追加する別の方法で取得されました。 、この最終段階でこのパラメーターをCGContextShowTextAtPointに渡すという問題に直面しています。これは私のコードです。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
NSUInteger tapCount = [touch tapCount];
CGPoint location = [touch locationInView:touch.view];
textBox.center = location;
NSLog(@"location-%f,%f", location.x,location.y);
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touches moved");
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"touches ended");
}
テキストの位置を修正できるように、location.x,location.y,get の値が別のメソッドに渡される必要があります。
前もって感謝します