0

scrollview 内に imageview を含むイメージ マップを作成しました。imageview で特定の部分に触れた場合、その特定の部分にテキストを描画します。

そのためのライブラリはありますか?

4

1 に答える 1

0

次のように、最初にタッチポイントを取得することで、これを自分で行うことができます。

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *aTouch = [touches anyObject];
    CGPoint point = [aTouch locationInView:self];
    CGFloat xPos = point.x;
    CGFloat yPos = point.y;
}

次に、この情報を使用して、x と y をパラメーターとして受け取るメソッドを作成します。そして、プログラムで UITextField を作成します。

UITextField * textFieldRounded = [[UITextField alloc] initWithFrame:CGRectMake(inParameterX, inParameterY, 300, 50)];
textFieldRounded.textColor = [UIColor blackColor];
textFieldRounded.font = [UIFont systemFontOfSize:17.0];
textFieldRounded.backgroundColor = [UIColor clearColor];
textFieldRounded.autocorrectionType = UITextAutocorrectionTypeNo;
textFieldRounded.keyboardType = UIKeyboardTypeDefault;
textFieldRounded.returnKeyType = UIReturnKeyDone;
textFieldRounded.clearButtonMode = UITextFieldViewModeWhileEditing;

そして、それをビューに追加します:

[self.view addSubview:textFieldRounded];

テキスト フィールドで何をしたいかによっては、代わりにオブジェクトを作成することもできます。おそらく配列に保存します。さて、あなたは要点を理解します。

于 2013-04-17T07:55:58.813 に答える